Icon

You are viewing the documentation of TeamCity 9.x, which is not the most recently released version of TeamCity.
View this page in TeamCity 10.x and 2017.1 documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

 
Skip to end of metadata
Go to start of metadata

TeamCity integrates with NuGet package manager and provides:

  • NuGet feed based on the builds' published artifacts
  • A set of NuGet runners to be used in builds on Windows OS:
    • 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.
  • NuGet Dependency Trigger which allows triggering builds on NuGet feed updates
Icon
  • NuGet build runners are only supported on build agents running Windows OS.
  • NuGet build runners runners require an appropriate version on .NET Framework installed on the agent machine depending on the NuGet.exe version used: NuGet 2.8.6+ requires .NET 4.5+, NuGet 2.5.x requires .NET 4.0.

  • To use packages from an authenticated feed, see the NuGet Feed Credentials build feature.

On this page:

Typical Usage Scenarios

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:

  1. Go to Administration | NuGet Settings | NuGet.exe tab.
  2. Click Fetch NuGet.
  3. In Add NuGet, select which NuGet versions you want to be installed on agents.

    Icon

    It is recommended to use the release versions of NuGet.

  4. 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.

Icon

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 a NuGet Server instead of setting up your own repository.

Icon

TeamCity running on any of the supported operating systems (Windows, Linux, Mac OS X) can be used as a NuGet Server.

To start using TeamCity as a NuGet Server, click Enable on the Administration | NuGet Settings | NuGet Server page (available to server system administrators). Two different links will be displayed on the 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 on the Administration | Global Settings page.

When the NuGet Server is enabled, all NuGet packages published as TeamCity build artifacts will be indexed and will appear in NuGet feed. The feed will include the packages from the build configurations where the currently authenticated user has permission to view build artifacts ("View project" permission).

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), only specify NuGet packages as TeamCity build artifacts.
  • 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

  • Since TeamCity 9.1.4, you do not need to specify credentials for the internal NuGet feed access; if NuGet Feed Credentials are specified, they are ignored.

If the build artifacts are changed under TeamCity Data Directory manually, you need to instruct TeamCity to reindex NuGet feed. For that, click "reset" link for "buildsMetadata" under Administration > Diagnostic > Caches.

(info) Internet Explorer settings may need to be set to trust the TeamCity Server when working in a mixed authentication environment.
For a step-by-step example of NuGet setup see blog post: Setting up TeamCity as a native NuGet Server.

See also:

 

 

 

 

 

 

 

 

 

 

 

  • No labels