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.
Since TeamCity 2018.2, you can configure multiple NuGet feeds for a project in TeamCity.
On this page:
- Enabling NuGet Feed
- Indexing NuGet Packages
- Using TeamCity NuGet Feed
Enabling NuGet Feed
To start using TeamCity as a NuGet Server, you need to enable the NuGet Feed at the project level.
Go to the NuGet Feed page on the Project Settings page and enable the feed.
Since TeamCity 2018.2, the built-in TeamCity NuGet feed supports API v1/v2/v3.
On the page you will see the following feed endpoints:
If you have enabled 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 user should have "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 TeamCity server.
To reference TeamCity project feeds, use parameters as follows:
v3, for instance:
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:
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 selected build configurations only, add the NuGet packages indexer build feature to these build configurations
to index all
.nupkgfiles 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.
.nupkgfiles indexing is performed by the agent itself while publishing build artifacts.
Using NuGet push command
To publish the
.nupkg file into 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:
Using TeamCity NuGet Feed
You can add TeamCity NuGet feeds as package sources package 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: when the NuGet Installer or NuGet Publish build step is used, TeamCity will use the credentials 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.