TeamCity On-Premises 2020.2 Help

Using TeamCity as NuGet Feed

If you want to publish your NuGet packages to a limited audience, for example, to use them internally, you can use TeamCity as a NuGet feed. You can configure multiple NuGet feeds for a TeamCity project.

The built-in TeamCity NuGet feed supports API v1/v2/v3.

Enabling NuGet Feed

To start using TeamCity as a NuGet Server, you need to add a NuGet feed at the project level — in Project Settings | NuGet Feed. Multiple NuGet feeds can be configured for a project.

Click Add new NuGet Feed to create a feed. Optionally, enable Automatic packages indexing for the current project and its subprojects.

The following feed endpoints are available:

  • http://<teamcityUrl>/<authSchema>/app/nuget/feed/<projectName>/<feedName>/v1
  • http://<teamcityUrl>/<authSchema>/app/nuget/feed/<projectName>/<feedName>/v2
  • http://<teamcityUrl>/<authSchema>/app/nuget/feed/<projectName>/<feedName>/v3/index.json

If you have enabled a guest user, you will see the toggle between Basic HTTP authentication and Guest authentication for NuGet feed endpoints.

  • Basic HTTP authentication (with httpAuth prefix): to access packages, a user must have the "View project" permission.

  • Guest authentication (with guestAuth prefix): if a guest user login is enabled, packages will be visible to all users that have access to the TeamCity server.

To reference the TeamCity project feeds, use parameters as follows:

`teamcity.nuget.feed.<authSchema>.<projectName>.<feedName>.<apiVersion>

where:

  • authSchema could be guestAuth/ httpAuth

  • apiVersion is v1/ v2/ v3, for instance: teamcity.nuget.feed.httpAuth._Root.default.v2

On upgrading TeamCity to version 2018.2 or later, the deprecated parameters referencing the global NuGet feed will be automatically converted to the references to the default NuGet feed:

Deprecated reference

Current reference

teamcity.nuget.feed.server

teamcity.nuget.feed.guestAuth._Root.default.v2

teamcity.nuget.feed.auth.server

teamcity.nuget.feed.httpAuth._Root.default.v2

system.teamcity.nuget.feed.auth.serverRootUrlBased.server

teamcity.nuget.feed.httpAuth._Root.default.v2

Indexing NuGet Packages

Indexing packages published as artifacts

By default, TeamCity will not add .nupkg artifacts published by builds into the project NuGet feed. You can select one of the following options:

  • To index packages published by the selected build configurations only, add the NuGet packages indexer build feature to these build configurations.

  • To index all .nupkg files published as build artifacts in the project, enable Automatic NuGet Packages Indexing in the NuGet Feed section of the Project Settings.

  • Use the NuGet Pack build step with the Publish created packages to build artifacts checkbox.
    An agent indexes the .nupkg files while publishing build artifacts.

Using NuGet push command

To publish the .nupkg file into the TeamCity NuGet feed during the build, you can specify the NuGet feed URL as a package source and the %teamcity.nuget.feed.api.key% value as a feed key in the following build steps:

Note that pushing a package is only possible from within a build. Any attempts to push external packages into the TeamCity feed will fail.

Symbol Packages

Publishing of NuGet symbol packages to an internal TeamCity feed may cause issues when using an external source server. See the corresponding issue in our public tracker.

Using TeamCity NuGet Feed

You can add TeamCity NuGet feeds as package sources on your developer machine. For example, to use packages during development, use the nuget sources command or NuGet package management in your IDE.

You can use TeamCity NuGet feeds to restore packages in your builds via the NuGet Installer and NuGet Publish build runners, or the .NET runner with the MSBuild restore target. Obsolete MSBuild and Visual Studio (sln) runners are also supported.
TeamCity uses own credential provider to automatically authenticate requests to the private TeamCity NuGet feeds.

Internet Explorer settings may need to be set to trust the TeamCity server when working in a mixed authentication environment.

Last modified: 03 March 2021