Get started with NuGet packages in Azure Artifacts

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

Azure Artifacts enables developers to publish and download NuGet packages from different sources such as feeds and public registries. With Azure Artifacts, you can create feeds that can be either private, allowing you to share packages with your team and specific users, or public, enabling you to share them openly with anyone on the internet.

In this article, you'll learn how to:

  • Create a new feed.
  • Set up your project and connect to your feed.
  • Publish NuGet packages.
  • Download packages from your feed.

Prerequisites

Create Feed

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, and then select Create Feed to create a new feed.

  3. Enter a descriptive Name for your feed and define its Visibility (indicating who can view packages within the feed). Specify the Scope of your feed, and if you wish to include packages from public sources, mark the Upstream sources checkbox.

  4. Select Create when you're done.

    A screenshot showing how to create a new feed in Azure DevOps Services.

  1. Sign in to your Azure DevOps server, and then navigate to your project.

  2. Select Artifacts, and then select Create Feed to create a new feed.

  3. Enter a descriptive Name for your feed and define its Visibility (indicating who can view packages within the feed). Specify the Scope of your feed, and if you wish to include packages from public sources, mark the Upstream sources checkbox.

  1. Select Create when you're done.

    A screenshot showing how to create a new feed in Azure DevOps 2022.

  1. Select Create when you're done.

    A screenshot showing how to create a new feed in Azure DevOps 2020.

  1. Sign in to your Azure DevOps server, and then navigate to your project.

  2. Select Artifacts, and then select New feed.

  3. Enter a descriptive Name for your feed and define its Visibility (indicating who can view packages within the feed). If you wish to include packages from public sources, select the Use packages from public sources through this feed option.

  4. Select Create when you're done.

    A screenshot showing how to create a new feed in Azure DevOps 2019.

Note

By default, newly created feeds have their project's Build Service set to Feed and Upstream Reader (Collaborator).

Connect to Feed

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select Connect to feed, and then select NuGet.exe from the left navigation pane. If this is the first time using Azure Artifacts with Nuget.exe, ensure that you have installed all the prerequisites.

    A screenshot showing the connect to feed button.

  4. Follow the instructions provided in the Project setup section to configure your nuget.config file and authenticate with Azure Artifacts.

    A screenshot showing how to set up your project.

  1. Sign in to your Azure DevOps server, and then navigate to your project.

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select Connect to Feed, and then select NuGet.exe from the left.

  4. Follow the instructions in the Project setup section to connect to your feed.

    A screenshot showing how to set up your NuGet project in Server 2020 and Server 2022.

  1. Sign in to your Azure DevOps server, and then navigate to your project.

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select Connect to Feed, and then select NuGet from the left.

  4. Follow the instructions to add your package source URL to your nuget.config.

    A screenshot showing how to set up your NuGet project in Server 2019.

Download packages

1. Get the package source URL

  1. Sign in to your Azure DevOps server, and then navigate to your project.

  2. Select Artifacts, select your feed from the dropdown menu, and then select Connect to feed.

  3. Select NuGet from the left, and then copy your Package source URL.

  1. Sign in to your Azure DevOps, and then navigate to your project.

  2. Select Artifacts, select your feed from the dropdown menu, and then select Connect to feed.

  3. Select Visual Studio from the left navigation panel, and then copy your Source URL.

    A screenshot showing the source URL.

2. Set up Visual Studio

  1. In Visual Studio, select Tools, and then Options.

  2. Expand the NuGet Package Manager section, and then select Package Sources.

  3. Enter the feed's Name and the Source URL, and then select the green (+) sign to add a source.

  4. If you enabled upstream sources in your feed, clear the nuget.org checkbox.

  5. Select OK when you're done.

    A screenshot showing how to set up visual studio in Windows.

3. Download packages

  1. In Visual Studio, right-click on your project, and then select Manage NuGet Packages.

  2. Select Browse, and then select your feed from the Package source dropdown menu.

    A screenshot showing how to select your package source in Visual Studio.

  3. Use the search bar to search for packages from your feed.

Note

Using NuGet Package Explorer to search for packages in upstream sources is not supported.

Publish packages

Run the following command to publish your package to your feed. You can enter any string for the ApiKey argument.

nuget.exe push -Source <SOURCE_NAME> -ApiKey key <PACKAGE_PATH>