0
votes

I have a C# dotnet core solution and it contains many projects. Then I want to publish my solution to distribute my build application.

When I run dotnet publish -o publish/win1064 -r win10-x64 in a folder with the sln file (I'm using dotnet core sdk 3.1), all build artifacts (dlls) are stored in the publish/win1064 folder. I want to have some projects to be published in a subfolders, like publish/win1064/plugins/pluginA for a project "pluginA" for example.

I can do it by running the dotnet publish for every project and set the output folder accordingly, but is there any way to do it with a one command?

1

1 Answers

0
votes

I'm not aware of a safe way of invoking dotnet publish at solution level, I would strongly advise you not to do it. You can find other answers stating the same out there.

That's why most CI tools allow you to use some kind of wildcards (i.e., **/*.csproj) to run dotnet commands over multiple projects, but not at solution level.

You'd face similar issues if you try to run tests at solution level and collect coverage/test results from that. (i.e. dotnet test /p:CollectCoverage=true /p:CoverletOutput=./CoverageResults).