dotnet-installer/Documentation/manpages/sdk/dotnet-publish.1
2018-03-30 11:48:04 -04:00

190 lines
7.5 KiB
Groff

.\" Automatically generated by Pandoc 2.1.3
.\"
.TH "dotnet publish command \- .NET Core CLI" "1" "" "" ".NET Core"
.hy
.SH dotnet publish
.PP
.SH NAME
.PP
\f[C]dotnet\ publish\f[] \- Packs the application and its dependencies into a folder for deployment to a hosting system.
.SH SYNOPSIS
.SS .NET Core 2.x
.IP
.nf
\f[C]
dotnet\ publish\ [<PROJECT>]\ [\-c|\-\-configuration]\ [\-f|\-\-framework]\ [\-\-force]\ [\-\-manifest]\ [\-\-no\-dependencies]\ [\-\-no\-restore]\ [\-o|\-\-output]\ [\-r|\-\-runtime]\ [\-\-self\-contained]\ [\-v|\-\-verbosity]\ [\-\-version\-suffix]
dotnet\ publish\ [\-h|\-\-help]
\f[]
.fi
.SS .NET Core 1.x
.IP
.nf
\f[C]
dotnet\ publish\ [<PROJECT>]\ [\-c|\-\-configuration]\ [\-f|\-\-framework]\ [\-o|\-\-output]\ [\-r|\-\-runtime]\ [\-v|\-\-verbosity]\ [\-\-version\-suffix]
dotnet\ publish\ [\-h|\-\-help]
\f[]
.fi
.PP
* * * * *
.SH DESCRIPTION
.PP
\f[C]dotnet\ publish\f[] compiles the application, reads through its dependencies specified in the project file, and publishes the resulting set of files to a directory.
The output will contain the following:
.IP \[bu] 2
Intermediate Language (IL) code in an assembly with a \f[I]dll\f[] extension.
.IP \[bu] 2
\f[I].deps.json\f[] file that contains all of the dependencies of the project.
.IP \[bu] 2
\f[I].runtime.config.json\f[] file that specifies the shared runtime that the application expects, as well as other configuration options for the runtime (for example, garbage collection type).
.IP \[bu] 2
The application's dependencies.
These are copied from the NuGet cache into the output folder.
.PP
The \f[C]dotnet\ publish\f[] command's output is ready for deployment to a hosting system (for example, a server, PC, Mac, laptop) for execution and is the only officially supported way to prepare the application for deployment.
Depending on the type of deployment that the project specifies, the hosting system may or may not have the .NET Core shared runtime installed on it.
For more information, see .NET Core Application Deployment.
For the directory structure of a published application, see Directory structure.
.PP
.SS Arguments
.PP
\f[C]PROJECT\f[]
.PP
The project to publish, which defaults to the current directory if not specified.
.SH OPTIONS
.SS .NET Core 2.x
.PP
\f[C]\-c|\-\-configuration\ {Debug|Release}\f[]
.PP
Defines the build configuration.
The default value is \f[C]Debug\f[].
.PP
\f[C]\-f|\-\-framework\ <FRAMEWORK>\f[]
.PP
Publishes the application for the specified target framework.
You must specify the target framework in the project file.
.PP
\f[C]\-\-force\f[]
.PP
Forces all dependencies to be resolved even if the last restore was successful.
This is equivalent to deleting the \f[I]project.assets.json\f[] file.
.PP
\f[C]\-h|\-\-help\f[]
.PP
Prints out a short help for the command.
.PP
\f[C]\-\-manifest\ <PATH_TO_MANIFEST_FILE>\f[]
.PP
Specifies one or several target manifests to use to trim the set of packages published with the app.
The manifest file is part of the output of the \f[C]dotnet\ store\f[].
To specify multiple manifests, add a \f[C]\-\-manifest\f[] option for each manifest.
This option is available starting with .NET Core 2.0 SDK.
.PP
\f[C]\-\-no\-dependencies\f[]
.PP
Ignores project\-to\-project references and only restores the root project.
.PP
\f[C]\-\-no\-restore\f[]
.PP
Doesn't perform an implicit restore when running the command.
.PP
\f[C]\-o|\-\-output\ <OUTPUT_DIRECTORY>\f[]
.PP
Specifies the path for the output directory.
If not specified, it defaults to \f[I]./bin/[configuration]/[framework]/\f[] for a framework\-dependent deployment or \f[I]./bin/[configuration]/[framework]/[runtime]\f[] for a self\-contained deployment.
If a relative path is provided, the output directory generated is relative to the project file location, not to the current working directory.
.PP
\f[C]\-\-self\-contained\f[]
.PP
Publishes the .NET Core runtime with your application so the runtime doesn't need to be installed on the target machine.
If a runtime identifier is specified, its default value is \f[C]true\f[].
For more information about the different deployment types, see .NET Core application deployment.
.PP
\f[C]\-r|\-\-runtime\ <RUNTIME_IDENTIFIER>\f[]
.PP
Publishes the application for a given runtime.
This is used when creating a self\-contained deployment (SCD).
For a list of Runtime Identifiers (RIDs), see the RID catalog.
Default is to publish a framework\-dependent deployment (FDD).
.PP
\f[C]\-v|\-\-verbosity\ <LEVEL>\f[]
.PP
Sets the verbosity level of the command.
Allowed values are \f[C]q[uiet]\f[], \f[C]m[inimal]\f[], \f[C]n[ormal]\f[], \f[C]d[etailed]\f[], and \f[C]diag[nostic]\f[].
.PP
\f[C]\-\-version\-suffix\ <VERSION_SUFFIX>\f[]
.PP
Defines the version suffix to replace the asterisk (\f[C]*\f[]) in the version field of the project file.
.SS .NET Core 1.x
.PP
\f[C]\-c|\-\-configuration\ {Debug|Release}\f[]
.PP
Defines the build configuration.
The default value is \f[C]Debug\f[].
.PP
\f[C]\-f|\-\-framework\ <FRAMEWORK>\f[]
.PP
Publishes the application for the specified target framework.
You must specify the target framework in the project file.
.PP
\f[C]\-h|\-\-help\f[]
.PP
Prints out a short help for the command.
.PP
\f[C]\-\-manifest\ <PATH_TO_MANIFEST_FILE>\f[]
.PP
Specifies one or several target manifests to use to trim the set of packages published with the app.
The manifest file is part of the output of the \f[C]dotnet\ store\f[].
To specify multiple manifests, add a \f[C]\-\-manifest\f[] option for each manifest.
This option is available starting with .NET Core 2.0 SDK.
.PP
\f[C]\-o|\-\-output\ <OUTPUT_DIRECTORY>\f[]
.PP
Specifies the path for the output directory.
If not specified, it defaults to \f[I]./bin/[configuration]/[framework]/\f[] for a framework\-dependent deployment or \f[I]./bin/[configuration]/[framework]/[runtime]\f[] for a self\-contained deployment.
If a relative path is provided, the output directory generated is relative to the project file location, not to the current working directory.
.PP
\f[C]\-r|\-\-runtime\ <RUNTIME_IDENTIFIER>\f[]
.PP
Publishes the application for a given runtime.
This is used when creating a self\-contained deployment (SCD).
For a list of Runtime Identifiers (RIDs), see the RID catalog.
Default is to publish a framework\-dependent deployment (FDD).
.PP
\f[C]\-v|\-\-verbosity\ <LEVEL>\f[]
.PP
Sets the verbosity level of the command.
Allowed values are \f[C]q[uiet]\f[], \f[C]m[inimal]\f[], \f[C]n[ormal]\f[], \f[C]d[etailed]\f[], and \f[C]diag[nostic]\f[].
.PP
\f[C]\-\-version\-suffix\ <VERSION_SUFFIX>\f[]
.PP
Defines the version suffix to replace the asterisk (\f[C]*\f[]) in the version field of the project file.
.PP
* * * * *
.SH EXAMPLES
.PP
Publish the project in the current directory:
.PP
\f[C]dotnet\ publish\f[]
.PP
Publish the application using the specified project file:
.PP
\f[C]dotnet\ publish\ ~/projects/app1/app1.csproj\f[]
.PP
Publish the project in the current directory using the \f[C]netcoreapp1.1\f[] framework:
.PP
\f[C]dotnet\ publish\ \-\-framework\ netcoreapp1.1\f[]
.PP
Publish the current application using the \f[C]netcoreapp1.1\f[] framework and the runtime for \f[C]OS\ X\ 10.10\f[] (you must list this RID in the project file).
.PP
\f[C]dotnet\ publish\ \-\-framework\ netcoreapp1.1\ \-\-runtime\ osx.10.11\-x64\f[]
.PP
Publish the current application but don't restore project\-to\-project (P2P) references, just the root project during the restore operation (.NET Core SDK 2.0 and later versions):
.PP
\f[C]dotnet\ publish\ \-\-no\-dependencies\f[]
.SS See also
.IP \[bu] 2
Target frameworks
.IP \[bu] 2
Runtime IDentifier (RID) catalog
.SH AUTHORS
mairaw.