Publish Self-Contained dotnet applications
From Logic Wiki
Contents
.NET Core 1.1 – How to publish a self-contained application
in .csproj file add this line into <PropertyGroup> tags
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
win10-x64 is identifier of the operating system where we aim to publish.
To target more than one operating system
<RuntimeIdentifiers>win10-x64;osx.10.11-x64;ubuntu.16.10-x64</RuntimeIdentifiers>
After saved the changes, it is necessary to run the following command to restore the dependencies:
dotnet restore
To generate the self-contained application, run the following command:
dotnet publish -c release -r win10-x64
there is also --output parameter to copy published app to a specified folder
Runtime Identifiers List
visit https://docs.microsoft.com/en-us/dotnet/core/rid-catalog to get most up-to-date list.
List
Windows RIDs
- Windows 7 / Windows Server 2008 R2
- win7-x64
- win7-x86
- Windows 8 / Windows Server 2012
- win8-x64
- win8-x86
- win8-arm
- Windows 8.1 / Windows Server 2012 R2
- win81-x64
- win81-x86
- win81-arm
- Windows 10 / Windows Server 2016
- win10-x64
- win10-x86
- win10-arm
- win10-arm64
Linux RIDs
- Red Hat Enterprise Linux
- rhel.7-x64
- Ubuntu
- ubuntu.14.04-x64
- ubuntu.14.10-x64
- ubuntu.15.04-x64
- ubuntu.15.10-x64
- ubuntu.16.04-x64
- ubuntu.16.10-x64
- CentOS
- centos.7-x64
- Debian
- debian.8-x64
- Fedora
- fedora.23-x64
- fedora.24-x64
- OpenSUSE
- opensuse.13.2-x64
- opensuse.42.1-x64
- Oracle Linux
- ol.7-x64
- ol.7.0-x64
- ol.7.1-x64
- ol.7.2-x64
- Currently supported Ubuntu derivatives
- linuxmint.17-x64
- linuxmint.17.1-x64
- linuxmint.17.2-x64
- linuxmint.17.3-x64
- linuxmint.18-x64
OS X RIDs
- osx.10.10-x64
- osx.10.11-x64
- osx.10.12-x64