officefileapi-401445-installation-guide-publish-net-core-application.md
This article describes how to deploy a .NET application. The following deployment modes are available:
Self-Contained Creates an application that includes all its dependencies and the .NET runtime. Users can run this application on a machine that does not have the .NET runtime installed. Framework-Dependent Creates an application that does not include the .NET runtime. Users should install the .NET runtime separately to run this application.
See the following topic for more information on application deployment modes: .NET Application Publishing Overview.
Use the dotnet publish command to publish a .NET application from the command line.
# Framework-dependent deployment
# for the current platform
dotnet publish -c Release
# Framework-dependent deployment
# for a specific platform
dotnet publish -c Release -r <RID> --self-contained false
# Self-contained deployment
dotnet publish -c Release -r <RID> --self-contained true
The -r <RID> option specifies the target platform where the application should run: win-x86, win-x64, linux-x64, osx-x64, and so on.
See the .NET Runtime Identifier catalog.
Right-click the project’s name in the Solution Explorer and select Publish.
In the invoked dialog, select Folder as the publish target and click Next.
On the Specific target tab, select Folder and click Next.
On the Location tab, specify the path to the target folder and click Finish.
Click Publish to publish your application to the selected folder.
You can pack your application and its dependencies (including the .NET runtime) into a single executable as described below.
Specify the Runtime Identifier and set the PublishSingleFile option to true in your project file.
<PropertyGroup>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
Run the dotnet publish command with the following parameters:
dotnet publish -r win-x64 /p:PublishSingleFile=true
You can compile your application in a ReadyToRun (R2R) format to improve the application startup time.
To publish your project as ReadyToRun , set the PublishReadyToRun option to true in your project file:
<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
If you enable the ReadyToRun option, the application size increases because R2R binaries contain both intermediate language and native code (similar to what the just-in-time compiler produces). This native code reduces the JIT compiler workload during application startup.
R2R format is only available when you publish an app that targets a specific runtime environment (such as Windows x64 or Linux x64).