2018-03-30 15:45:24 +00:00
. \" Automatically generated by Pandoc 2.1.3
2016-06-14 13:42:21 +00:00
. \"
2018-03-30 15:45:24 +00:00
.TH "dotnet pack command \- .NET Core CLI" "1" "" "" ".NET Core"
2016-06-14 13:42:21 +00:00
.hy
2018-03-30 15:45:24 +00:00
.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
2016-06-14 13:42:21 +00:00
.IP
.nf
\f[C]
2018-03-30 15:45:24 +00:00
dotnet\ pack\ [<PROJECT>]\ [\-c|\-\-configuration]\ [\-\-include\-source]\ [\-\-include\-symbols]\ [\-\-no\-build]\ [\-o|\-\-output]\ [\-s|\-\-serviceable]\ [\-v|\-\-verbosity]\ [\-\-version\-suffix]
dotnet\ pack\ [\-h|\-\-help]
2016-06-14 13:42:21 +00:00
\f[]
.fi
.PP
2018-03-30 15:45:24 +00:00
* * * * *
.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.
2016-06-14 13:42:21 +00:00
.PP
2018-03-30 15:45:24 +00:00
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[]
2016-06-14 13:42:21 +00:00
.PP
The project to pack.
2018-03-30 15:45:24 +00:00
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.
2016-06-14 13:42:21 +00:00
.PP
2018-03-30 15:45:24 +00:00
\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[]
2016-06-14 13:42:21 +00:00
.PP
Places the built packages in the directory specified.
.PP
2018-03-30 15:45:24 +00:00
\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
2016-06-14 13:42:21 +00:00
\f[C]\-\-no\-build\f[]
.PP
2018-03-30 15:45:24 +00:00
Doesn't build the project before packing.
2016-06-14 13:42:21 +00:00
.PP
2018-03-30 15:45:24 +00:00
\f[C]\-o|\-\-output\ <OUTPUT_DIRECTORY>\f[]
2016-06-14 13:42:21 +00:00
.PP
2018-03-30 15:45:24 +00:00
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[] .
2016-06-14 13:42:21 +00:00
.PP
2018-03-30 15:45:24 +00:00
* * * * *
.SH EXAMPLES
2016-06-14 13:42:21 +00:00
.PP
2018-03-30 15:45:24 +00:00
Pack the project in the current directory:
2016-06-14 13:42:21 +00:00
.PP
\f[C]dotnet\ pack\f[]
.PP
2018-03-30 15:45:24 +00:00
Pack the \f[C]app1\f[] project:
2016-06-14 13:42:21 +00:00
.PP
2018-03-30 15:45:24 +00:00
\f[C]dotnet\ pack\ ~/projects/app1/project.csproj\f[]
2016-06-14 13:42:21 +00:00
.PP
2018-03-30 15:45:24 +00:00
Pack the project in the current directory and place the resulting packages into the \f[C]nupkgs\f[] folder:
2016-06-14 13:42:21 +00:00
.PP
\f[C]dotnet\ pack\ \-\-output\ nupkgs\f[]
.PP
2018-03-30 15:45:24 +00:00
Pack the project in the current directory into the \f[C]nupkgs\f[] folder and skip the build step:
2016-06-14 13:42:21 +00:00
.PP
\f[C]dotnet\ pack\ \-\-no\-build\ \-\-output\ nupkgs\f[]
.PP
2018-03-30 15:45:24 +00:00
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[]
2016-06-14 13:42:21 +00:00
.SH AUTHORS
2018-03-30 15:45:24 +00:00
mairaw.