NuGet
TeamCity integrates with NuGet package manager and, when NuGet is installed on agents, provides the following capabilities:
A set of NuGet runners to be used in builds on Windows OS, as well as on Linux and macOS when Mono is installed on the agent.
NuGet Installer build runner, which installs and updates NuGet packages.
NuGet Pack build runner, which builds NuGet packages.
NuGet Publish build runner, which publishes packages to a feed of your choice.
NuGet dependency trigger, which allows triggering builds on NuGet feed updates.
tip
Note that TeamCity Cloud currently doesn't support automatic delivery of tools to build agents. To be able to use the NuGet runners, you need to download and install the required version of NuGet on the agent. You can do this manually (only on self-hosted agents) or via any convenient utility step at the beginning of the build (for example, Command Line). When configuring a NuGet build step, you will need to specify the path to NuGet relatively to the build checkout directory.
Supported Operating Systems:
NuGet build runners are supported on build agents running Windows OS by default. Linux and macOS are supported when Mono is installed on the agent (only NuGet 3.3+ on Mono 4.4.2+ is supported).
note
NuGet build runners require an appropriate version on .NET Framework installed on the agent machine depending on the
NuGet.exe
version:
NuGet versions 2.8.6+ require .NET 4.5+
NuGet versions \< 2.8.6 require .NET 4.0.
To use packages from an authenticated feed, see the NuGet Feed Credentials build feature.
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 trigger a new build when a NuGet package is updated, use the NuGet Dependency Trigger.
NuGet uses several local caches to avoid downloading packages that are already installed, and to provide offline support. If an agent is running out of the space, TeamCity will try to clean NuGet packages cache on the agent.
The TeamCity NuGet cleaner cleans caches in the following Windows directories:
%%NUGET_PACKAGES%% environment variable
(must be an absolute path)%%LOCALAPPDATA%%\NuGet\Cache
%%LOCALAPPDATA%%\NuGet\v3-cache
%%user.home%\.nuget\packages
Since TeamCity 2019.2.3, the new automatic package cleaner has been introduced in addition to the existing NuGet cleaner. If .NET SDK is installed on a build agent, TeamCity will use native .NET SDK commands for cleaning. The new cleaner works across all platforms supporting .NET SDK and operates on several levels. It cleans the temporary cache first, and only then gets to cleaning the .nupkg
files and HTTP requests, if necessary.
You can use authentication in the feeds specified in the NuGet feed credentials build feature. The credentials' provider will automatically authenticate requests to these feeds.
API support:
NuGet Installer / NuGet Publish runners
v3: requires NuGet 4.8+ (Windows), NuGet 4.9+ on Mono
v1/v2: NuGet 2.0+ is minimum requirement, NuGet 3.5+ is recommended
.NET
v3: requires .NET CLI 2.1.500
v1/v2: not supported
NuGet command line client supports proxy server configuration via the NuGet.config
file parameters or environment variables. See NuGet documentation for more details.
Thanks for your feedback!