On this page:
|Table of Contents|
TeamCity integrates with NuGet package manager and when NuGet is installed provides the following capabilities:
- NuGet feed based on the builds' published artifacts
- A set of NuGet runners to be used in builds on Windows OS; and since TeamCity 2017.1 on Linux and Mac OSX when Mono is installed on the agent (. Only NuGet 3.2 is strongly recommended with Mono).+ on Mono 4.4.2+ is supported.
- the NuGet Installer build runner, which installs and updates NuGet packages
- the NuGet Pack build runner, which builds NuGet packages
- the NuGet Publish build runner, which publishes packages to a feed of your choice
On this page:
|Table of Contents|
Typical Usage Scenarios
- To install packages from a public feed, add the NuGet Installer build step.
- To create a package and publish it to a public feed, add the NuGet Pack and NuGet Publish build steps.
- To create a package and publish it to the internal TeamCity NuGet Server, enable TeamCity as a NuGet Server (see the section below), use the NuGet Pack build step and NuGet Publish build steps.
- To trigger a new build when a NuGet package is updated, use NuGet Dependency Trigger.
Installing NuGet on agents results in agents upgrade.
NuGet Packages Cache Clean-up on Agents
NuGet uses several local caches to avoid downloading packages that are already installed, and to provide offline support.
Since TeamCity 2017.2, if an agent is running out of the space, TeamCity will try to clean NuGet packages cache on the agent.
The caches in the following directories will be cleaned:
%NUGET_PACKAGES% environment variable(must be an absolute path)
Using TeamCity as NuGet Server
TeamCity running on any of the supported operating systems (Windows, Linux, Mac OS X) can be used as a NuGet Server.
Since TeamCity 9.0 built-in NuGet feed supports API v2 by default.
TeamCity NuGet feed users are recommended to upgrade to TeamCity 10.0.2 and later, as 10.0.2 provides improved compatibility with NuGet.
You can publish packages to the feed either as build artifacts of the NuGet Pack build step (using the Publish created packages to build artifacts checkbox - in this case you do not need the NuGet Publish build step, packages will be indexed asynchronously) or via the NuGet Publish build step (since TeamCity 2017.1 packages will be indexed synchronously)
You can add TeamCity NuGet server to your repositories in Visual Studio to avoid having to type in long URLs each time you want to read from a specific package repository (add NuGet repository and specify the public URL provided by TeamCity when enabling NuGet server).
The packages available in the feed are bound to the builds' artifacts: they are removed from the feed when the artifacts of the build which produced them are cleaned up.
You do not need to specify credentials for the internal NuGet feed access; if NuGet Feed Credentials are specified, they are ignored.
Publishing of NuGet symbol packages to the internal TeamCity feed may cause issues when using an external source server. See the corresponding issue in our public tracker.
NuGet command line client supports proxy server configuration via NuGet.config file parameters or environment variables. See NuGet documentation for more details.
Administrator's Guide: NuGet Installer | NuGet Publish | NuGet Pack | NuGet Dependency Trigger