NuGet
TeamCity integrates with NuGet package manager and provides:
Using-TeamCity-as-NuGet-Server based on the builds' published artifacts
A set of NuGet runners to be used in the build on Windows OS:
Install and update NuGet packages: NuGet Installer build runner;
Pack NuGet packages: NuGet Pack build runner;
Publish packages to a feed of your choice: NuGet Publish build runner.
NuGet Dependency Trigger which allows triggering builds on NuGet feed updates
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 trigger a new build when a NuGet package is updated, use NuGet Dependency Trigger.
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 properly configure Configuring General Settings.
Installing NuGet to TeamCity agents
The NuGet trigger and the NuGet-related build runners require the NuGet command line binary configured on the server. They are automatically distributed to agents once configured.
To do it in TeamCity:
Go to Administration | NuGet Settings | NuGet.exe tab.
Click Fetch NuGet.
In Add NuGet, select which NuGet versions you want to be installed on agents.
Select the default version.
You can also upload your own NuGet package containing NuGet.exe instead of downloading it from the public feed using Upload NuGet.
Using TeamCity as NuGet Server
If for some reason you don't want to publish packages to public feed, e.g. you're producing packages that are intended to be used internally; you can use TeamCity as a native NuGet Server instead of setting up your own repository.
To start using TeamCity as a NuGet Server, click Enable on the Administration | NuGet Settings | NuGet Server page. Two different links will be displayed on the same page: for public (with guestAuth
prefix) and private (with httpAuth
prefix) feed. If Public Url is not available, you need to enable the Guest User in TeamCity on the Administration | Global Settings page.
For an example of set up see blog post: Setting up TeamCity as a native NuGet Server.
When you have TeamCity NuGet server enabled:
You don't need to use NuGet Publish build step (unless you want to publish packages on some public feed).
You can work with built NuGet packages as with build artifacts: remember to specify Configuring General Settings in the General Settings of your build configuration.
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 Clean-Up.