How to publish multiple runtimes with dotnet cli to custom output folders

Viewed 360

I have a csproj file which contains a few target runtimes, and I was hoping to have a singular command I could run which would build them all and put them in a designated directory. Something like this:

dotnet publish -c release -o ../../some-dist-folder

If I run this command I get a some-dist-folder full of good stuff, but I am unsure if it is just outputting a single runtime or all runtimes, as the folder contains:

|- *.dll
|- Refs
   |- *.dll
|- Runtimes
   |- Lots of folders

So there is no exe (not that surprised as thats only a windows thing) and the Runtimes seems to contain loads of folders relating to various linux/mac/windows runtimes etc.

However if I was to run:

dotnet publish -c release -r win-x64 -o ../../some-dist-folder

I get some apphost.exe and some other files and the runtimes folder is gone, so I am left wondering if the former approach where I am trying to just build everything at once is not actually working and I need to explicitly publish for each platform or if I need to manually pick out the bits I care about from the output.

Ideally I was hoping to run a command like the ones above and get an output folder like:

|- some-dist-folder
   |- win-x64
   |- osx-some-version
   |- some-linux-distro-version
   |- other-runtimes-version

So can I get close to this in a single command or is it just safer to manually run each publish explicitly?

0 Answers
Related