dotnet-pack - Man Page

Packs the code into a NuGet package.

dotnet pack

This topic applies to: ✓ .NET Core 1.x SDK and later versions

Synopsis

dotnet pack [<PROJECT>|<SOLUTION>] [-c|--configuration] [--force] [--include-source] [--include-symbols] [--interactive] 
    [--no-build] [--no-dependencies] [--no-restore] [--nologo] [-o|--output] [--runtime] [-s|--serviceable] 
    [-v|--verbosity] [--version-suffix]
dotnet pack [-h|--help]

Description

The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a .nupkg file).

If you want to generate a package that contains the debug symbols, you have two options available:

NuGet dependencies of the packed project are added to the .nuspec 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.

By default, dotnet pack builds the project first. If you wish to avoid this behavior, pass the --no-build option. This option is often useful in Continuous Integration (CI) build scenarios where you know the code was previously built.

You can provide MSBuild properties to the dotnet pack 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.

Web projects aren’t packable by default. To override the default behavior, add the following property to your .csproj file:

<PropertyGroup>
   <IsPackable>true</IsPackable>
</PropertyGroup>

Arguments

PROJECT | SOLUTION

The project or solution to pack. It’s either a path to a csproj file, a solution file, or to a directory. If not specified, the command searches the current directory for a project or solution file.

Options

Examples

Info

.NET Core