Get started with NuGet packages
Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018 - TFS 2017
Developers can use Azure Artifacts to publish and consume NuGet packages both to and from feeds and public registries. A feed is an organizational construct that hosts packages. You can create public and private feeds, and you can control who can access your packages by modifying feed permissions.
Prerequisites
- Install NuGet client tools
- Project and org permissions to use Azure Artifacts.
This quickstart assumes you've already set up Azure Artifacts. You can check out how to license the extension in the License Azure Artifacts guide.
Note
Azure Artifacts is an extension that comes pre-installed on TFS 2017 or newer, if it was removed from your organization, you can install it from the Azure Artifacts Marketplace.
Create a feed
With Azure Artifacts, you can create two types of feeds: project-scoped and organization-scoped feeds. All public feeds are project-scoped and they inherit the hosting project's visibility settings. By default, any feed that's created by using the web UI is a project-scoped feed.
From within your project, navigate to Azure Artifacts.

Select Create Feed.

Give your feed a Name and choose its visibility, upstream sources, and scope settings.

Select Create when you are done.
Azure Artifacts is installed by default for TFS 2017 customers. You must upgrade to TFS 2017 in order to use Azure Artifacts. If this is the first time using your feed, you might be asked to assign a license
Go to Build & Release and select Packages.

Select + New feed.

Give your feed a Name, a Description, and set up who can read, who can contribute and if you want to Include external packages.

Select Create when you are done.
Connect to feed and publish packages
With Azure Artifacts, you can publish your NuGet packages to public or private feeds, and then share them with others, depending on your feed's visibility settings.
Here's how to connect to your feed and publish a package.
From within your project, select Artifacts, and then select your feed. You can create a new feed if you don't have one already.
Select Connect to feed.
Select NuGet.exe under the NuGet header.
If this is the first time using Azure Artifacts with Nuget.exe, select Get the tools button and follow the instructions to install the prerequisites.
- Download the latest NuGet version.
- Download and install the Azure Artifacts Credential Provider.
Follow the instructions in the Project setup to connect to your feed.
Publish a NuGet package by using the command line
If you don't have a NuGet package but you want to try publishing your package to your feed, you can install the HelloWorld sample package.
nuget install HelloWorld -ExcludeVersion
Run the following command to publish your package to your feed:
nuget.exe push -Source "<YOUR_FEED_NAME>" -ApiKey <ANY_STRING> <PACKAGE_PATH>
Select Build and Release > Packages.
Select your feed from the dropdown menu or create one if you haven't.
Select Connect to feed.
Select NuGet and follow the instruction to connect to your feed.
Install and publish a sample NuGet package
If you don't have a NuGet package but want to practice the steps to publish our packages to your feed, you can install the HelloWorld sample package.
Install the sample NuGet package:
nuget install HelloWorld -ExcludeVersionSet up your nuget.config file and publish your package to your feed
nuget sources add -Name <SourceName> -Source <SourceURL> -username <UserName> -password <Pat> nuget push -Source <SourceName> -ApiKey az <PackagePath exp:(.\Get-Hello.1.0.0.nupkg)>
Consume packages in Visual Studio
To consume NuGet packages from your feed, you need to add the feed's NuGet endpoint as a package source in Visual Studio, as follows.
1. Get the feed's source URL
From within your project, select Artifacts, and then select your feed.
Select Connect to feed.
Select Visual Studio from the NuGet section .
Copy your feed's Source URL.
Select Build and Release, and then select Packages.
Select your feed from the dropdown menu.
Select Connect to feed.
Copy your feed's Source URL.
2. Set up Visual Studio
Set up package source
In Visual Studio, select Tools, and then Options.
Expand the NuGet Package Manager section, and then select Package Sources.
Enter the feed's Name and the Source URL, and then select the green (+) sign to add a source.
If you enabled upstream sources in your feed, clear the nuget.org check box.
Select OK.
3. Consume packages
You can now find and consume packages from your feed by using Visual Studio.
- In Visual Studio, right-click on your project in the Solution Explorer, and then select Manage NuGet Packages.
- Select Browse, and then select your feed from the Package source drop-down list
- Use the search bar to look for packages from your feed.
Note
If you're using upstream sources, any packages from upstream sources that haven't been saved to your feed yet (by using them at least once) won't appear in the Package Manager search result. To install those packages:
Consume package from NuGet.org
- Copy the Install-Package command from the public registry (NuGet.org).
- Select Tools then NuGet Package Manager to open the NuGet package manager.
- Paste the command into the Package Manager Console and select run.