TeamCity 7.0 Help

NuGet

TeamCity integrates with NuGet package manager and allows you to:

  • 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. Alternatively you can use TeamCity as NuGet server. To start working with NuGet integration, you need to have NuGet.exe Command Line tool installed on build agents: you don't need to do it manually, TeamCity can take care of this task for you.

Installing NuGet to TeamCity agents

You don't need to manually install the required NuGet.exe Command Line tool to all build agents, TeamCity can do this automatically. You need only to choose which NuGet versions you want to be installed on agents at Administration | NuGet Settings | NuGet Commandline tab. Starting with TeamCity 7.1 you can also upload your own NuGet.CommandLine package instead of downloading it from the public feed. Note also that installing NuGet on agents results in agents upgrade.

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 native NuGet Server instead of setting up your own repository. To start using TeamCity as NuGet Server you need to enable TeamCity server to be a NuGet server by clicking corresponding button at 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 login in TeamCity at 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: don't forget to specify Configuring General Settings in General Settings of your build configuration.

  • You can add TeamCity NuGet server to your repositories in Visual Studio to avoid having to type long URL's in each time you want to read from a specific package repository (add NuGet repository and specify public URL provided by TeamCity when enabling NuGet server).

Typical Usage Scenarios

  • To install packages from a public feed, add NuGet Installer build step. Note, that using this build step, packages are not checked in to your version control.

  • To create a package and publish it to a public feed, you need to add NuGet Pack and NuGet Publish build steps.

  • To create a package and publish it to internal TeamCity NuGet Server, you need to have it enabled (see above), use NuGet Pack build step and properly configure Configuring General Settings.

  • To trigger a new build when a NuGet package is updated use NuGet Dependency Trigger.

Last modified: 20 April 2023