Skip to end of metadata
Go to start of metadata

The NuGet Pack build runner allows building a NuGet package from a given specification file. If you want to publish this package, add a NuGet Publish build step.

Supported Operating Systems


NuGet build runners are supported on build agents running Windows OS by default.  Since TeamCity 2017.1 Linux and Mac OSX are supported when Mono is installed on the agent (NuGet command-line executable for Windows version 3.2 and later is strongly recommended with Mono).

Configure the following options of the NuGet Pack runner:




Select a NuGet version to use from the drop-down list (you need to have NuGet installed), or specify a custom path to NuGet.exe.


An appropriate version of .NET Framework installed on the agent machine is required depending on the NuGet.exe version used: NuGet 2.8.6+ requires .NET 4.5+, earlier NuGet versions require .NET 4.0.

Specification files

Enter path(s) to csproj or nuspec file(s). You can specify as many specification files here as you need. Wildcards are supported. If you specify here a csproj file, you won't have to redefine the version number and copyright information in the spec file.

Prefer project files to .nuspec

Check the box to use the project file (if exists, i.e. .csproj or .vbproj) for every matched .nuspec file.


Specify the package version. Overrides the version number from the nuspec file. You can use the TeamCity variable %build.number% here.

Base Directory

Select an option from the drop down list to specify the directory where the files defined in the nuspec file are located (the directory against which the paths in <files></files> from nuspec are resolved, usually some bin directory). If Use explicit directory is set and the field is left blank, TeamCity will use the build checkout directory as the base directory.

Output Directory

Specify the path where the generated NuGet package is to be put.

Сlean output directory

Check the box to clean the directory before packing.

Publish created packages to build artifacts

Check the box if you're using TeamCity as a NuGet repository to publish packages to the TeamCity's NuGet server and be able to use them as regular TeamCity artifacts.

Exclude files

Specify one or more wildcard patterns to exclude when creating a package. Equivalent to the NuGet.exe -Exclude argument.


Semicolon or new-line separated list of package creation properties. For example, to make a release build, you define here Configuration=Release.


Create tool package - check the box to place the output files of the project to the tool folder.
Include sources and symbols - check the box to create a package containing sources and symbols. When specified with a nuspec, it creates a regular NuGet package file and the corresponding symbols package (needed for publishing the sources to Symbolsource )

Command line parameters

Set additional command line parameters to be passed to NuGet.exe.

See also:

Administrator's Guide: NuGet Installer | NuGet Publish

  • No labels