The dotnet CLI
dotnet publish command you just have to add the
# for a linux build dotnet publish --configuration Release --runtime linux-x64 --self-contained false # for a windows build dotnet publish --configuration Release --runtime win-x64 --self-contained false
Argument : runtime
Most interresting runtime :
win-x64-> for windows
linux-x64-> for linux in general
linux-musl-x64-> for linux Alpine or other distributions using musl.
linux-arm-> for ARM Single Board Computers like the Odroid/Raspberry Pi
The full list of runtime can be found in the file runtime.json.
More information on the .NET Core RID Catalog.
Argument : self-contained (Bonus)
--self-contained false the folder don’t include the .NET Core runtime.
+ Cross-platform + Small size + Use the latest runtime installed on the OS - Require the runtime installed on the OS - New version of the runtime may change the behavior of the application
--self-contained true the folder include the .NET Core runtime.
+ You choose the .NET Core runtime of the application - Really greater size - Need to deploy a new version of the application to update .NET Core version.
More information on .NET Core application publishing overview