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

190 lines
6.2 KiB
Groff

.\" Automatically generated by Pandoc 2.1.3
.\"
.TH "dotnet pack command \- .NET Core CLI" "1" "" "" ".NET Core"
.hy
.SH dotnet pack
.PP
.SH NAME
.PP
\f[C]dotnet\ pack\f[] \- Packs the code into a NuGet package.
.SH SYNOPSIS
.SS .NET Core 2.x
.IP
.nf
\f[C]
dotnet\ pack\ [<PROJECT>]\ [\-c|\-\-configuration]\ [\-\-force]\ [\-\-include\-source]\ [\-\-include\-symbols]\ [\-\-no\-build]\ [\-\-no\-dependencies]
\ \ \ \ [\-\-no\-restore]\ [\-o|\-\-output]\ [\-\-runtime]\ [\-s|\-\-serviceable]\ [\-v|\-\-verbosity]\ [\-\-version\-suffix]
dotnet\ pack\ [\-h|\-\-help]
\f[]
.fi
.SS .NET Core 1.x
.IP
.nf
\f[C]
dotnet\ pack\ [<PROJECT>]\ [\-c|\-\-configuration]\ [\-\-include\-source]\ [\-\-include\-symbols]\ [\-\-no\-build]\ [\-o|\-\-output]\ [\-s|\-\-serviceable]\ [\-v|\-\-verbosity]\ [\-\-version\-suffix]
dotnet\ pack\ [\-h|\-\-help]
\f[]
.fi
.PP
* * * * *
.SH DESCRIPTION
.PP
The \f[C]dotnet\ pack\f[] command builds the project and creates NuGet packages.
The result of this command is a NuGet package.
If the \f[C]\-\-include\-symbols\f[] option is present, another package containing the debug symbols is created.
.PP
NuGet dependencies of the packed project are added to the \f[I].nuspec\f[] file, so they're properly resolved when the package is installed.
Project\-to\-project references aren't packaged inside the project.
Currently, you must have a package per project if you have project\-to\-project dependencies.
.PP
By default, \f[C]dotnet\ pack\f[] builds the project first.
If you wish to avoid this behavior, pass the \f[C]\-\-no\-build\f[] option.
This is often useful in Continuous Integration (CI) build scenarios where you know the code was previously built.
.PP
You can provide MSBuild properties to the \f[C]dotnet\ pack\f[] command for the packing process.
For more information, see NuGet metadata properties and the MSBuild Command\-Line Reference.
The Examples section shows how to use the MSBuild /p switch for a couple of different scenarios.
.PP
.SS Arguments
.PP
\f[C]PROJECT\f[]
.PP
The project to pack.
It's either a path to a csproj file or to a directory.
If omitted, it defaults to the current directory.
.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]\-\-force\f[] 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]\-\-include\-source\f[]
.PP
Includes the source files in the NuGet package.
The sources files are included in the \f[C]src\f[] folder within the \f[C]nupkg\f[].
.PP
\f[C]\-\-include\-symbols\f[]
.PP
Generates the symbols \f[C]nupkg\f[].
.PP
\f[C]\-\-no\-build\f[]
.PP
Doesn't build the project before packing.
.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
Places the built packages in the directory specified.
.PP
\f[C]\-r|\-\-runtime\ <RUNTIME_IDENTIFIER>\f[]
.PP
Specifies the target runtime to restore packages for.
For a list of Runtime Identifiers (RIDs), see the RID catalog.
.PP
\f[C]\-s|\-\-serviceable\f[]
.PP
Sets the serviceable flag in the package.
For more information, see .NET Blog: .NET 4.5.1 Supports Microsoft Security Updates for .NET NuGet Libraries.
.PP
\f[C]\-\-version\-suffix\ <VERSION_SUFFIX>\f[]
.PP
Defines the value for the \f[C]$(VersionSuffix)\f[] MSBuild property in the project.
.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[].
.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]\-h|\-\-help\f[]
.PP
Prints out a short help for the command.
.PP
\f[C]\-\-include\-source\f[]
.PP
Includes the source files in the NuGet package.
The sources files are included in the \f[C]src\f[] folder within the \f[C]nupkg\f[].
.PP
\f[C]\-\-include\-symbols\f[]
.PP
Generates the symbols \f[C]nupkg\f[].
.PP
\f[C]\-\-no\-build\f[]
.PP
Doesn't build the project before packing.
.PP
\f[C]\-o|\-\-output\ <OUTPUT_DIRECTORY>\f[]
.PP
Places the built packages in the directory specified.
.PP
\f[C]\-s|\-\-serviceable\f[]
.PP
Sets the serviceable flag in the package.
For more information, see .NET Blog: .NET 4.5.1 Supports Microsoft Security Updates for .NET NuGet Libraries.
.PP
\f[C]\-\-version\-suffix\ <VERSION_SUFFIX>\f[]
.PP
Defines the value for the \f[C]$(VersionSuffix)\f[] MSBuild property in the project.
.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
* * * * *
.SH EXAMPLES
.PP
Pack the project in the current directory:
.PP
\f[C]dotnet\ pack\f[]
.PP
Pack the \f[C]app1\f[] project:
.PP
\f[C]dotnet\ pack\ ~/projects/app1/project.csproj\f[]
.PP
Pack the project in the current directory and place the resulting packages into the \f[C]nupkgs\f[] folder:
.PP
\f[C]dotnet\ pack\ \-\-output\ nupkgs\f[]
.PP
Pack the project in the current directory into the \f[C]nupkgs\f[] folder and skip the build step:
.PP
\f[C]dotnet\ pack\ \-\-no\-build\ \-\-output\ nupkgs\f[]
.PP
With the project's version suffix configured as \f[C]<VersionSuffix>$(VersionSuffix)</VersionSuffix>\f[] in the \f[I].csproj\f[] file, pack the current project and update the resulting package version with the given suffix:
.PP
\f[C]dotnet\ pack\ \-\-version\-suffix\ "ci\-1234"\f[]
.PP
Set the package version to \f[C]2.1.0\f[] with the \f[C]PackageVersion\f[] MSBuild property:
.PP
\f[C]dotnet\ pack\ /p:PackageVersion=2.1.0\f[]
.PP
Pack the project for a specific target framework:
.PP
\f[C]dotnet\ pack\ /p:TargetFrameworks=net45\f[]
.PP
Pack the project and use a specific runtime (Windows 10) for the restore operation (.NET Core SDK 2.0 and later versions):
.PP
\f[C]dotnet\ pack\ \-\-runtime\ win10\-x64\f[]
.SH AUTHORS
mairaw.