Get started with NuGet packages in Azure Artifacts

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

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 a feed

Azure Artifacts offers two types of feeds: project-scoped feeds and organization-scoped feeds. if you want to create a public feed, begin by creating a project-scoped feed, and then adjust the visibility settings of the project hosting your feed to public. This will effectively make your project-scoped feed accessible to the public.

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

  2. Select Artifacts, and then select Create Feed.

    A screenshot showing the create a feed button.

  3. Provide a descriptive Name for your feed and specify its Visibility (determining who can view packages within the feed). Additionally, configure the Upstream sources and specify the Scope of your feed (project-scoped or organization-scoped).

    A screenshot showing how to create a need feed.

  4. Select Create when you're done.

Note

When creating a new feed, the default access level for the Project Collection Build Service (organization-scoped) and the project-level Build Service(project-scoped) is set to Collaborator.

Azure Artifacts comes pre-installed in TFS 2018. If this is the first time using your feed, you might be asked to assign a license

  1. Go to Build & Release and select Packages.

    Go to Azure Artifacts TFS

  2. Select + New feed.

    New feed button TFS

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

    New feed dialog box TFS

  4. Select Create when you're done.

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.

    A screenshot showing the connect to feed button.

  4. Select NuGet.exe. If this is the first time using Azure Artifacts with Nuget.exe, ensure that you have installed all the prerequisites.

  5. Follow the instructions provided in the Project setup section to configure your nuget.config file.

    A screenshot showing how to set up your project.

  1. Navigate to your project http://ServerName:8080/tfs/DefaultCollection/<ProjectName>.

  2. Select Build and Release > Packages.

  3. Select your feed from the dropdown menu.

  4. Select Connect to feed.

    A screenshot showing the connect to feed button in TFS.

  5. Select NuGet, and then follow the instruction to connect to your feed.

    A screenshot showing how to connect to your feed in TFS.

Download packages

1. Get the feed's source URL

  1. Navigate to your project, and then select Artifacts then select your feed.

  2. Select Connect to feed, and then select Visual Studio from the left navigation panel.

  3. Copy your Source URL.

    A screenshot showing the source URL.

  1. Select Build and Release, and then select Packages.

  2. Select your feed from the dropdown menu.

  3. Select Connect to feed, and then copy your Source URL.

    A screenshot showing the package source URL in TFS.

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 feed source.

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

Note

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

Publish packages

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

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