Quickstart: 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 sources such as feeds and public registries. With Azure Artifacts, you can create feeds that are either:

  • Private, so you can share packages with your team and specific users.
  • Public, so you can share packages openly with anyone on the internet.

In this quickstart, you 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

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

  2. Select Artifacts, and then select Create Feed.

  3. Provide a Name for your feed, choose the Visibility option that defines who can view your packages, check Include packages from common public sources if you want to include packages from sources like nuget.org or npmjs.com, and for Scope, decide whether the feed should be scoped to your project or the entire organization.

  4. Select Create when you're done.

    Screenshot that shows selections for creating a new feed in Azure DevOps Services.

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

  2. Select Artifacts, and then select Create Feed.

  3. Provide a Name for your feed, choose the Visibility option that defines who can view your packages, check Include packages from common public sources if you want to include packages from sources like nuget.org or npmjs.com, and for Scope, decide whether the feed should be scoped to your project or the entire organization.

  1. Select Create when you're done.

    Screenshot that shows selections for creating a new feed in Azure DevOps 2022.

  1. Select Create when you're done.

    Screenshot that shows selections for creating a new feed in Azure DevOps 2020.

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

  2. Select Artifacts, and then select New feed.

  3. For Name, enter a descriptive name for your feed.

    For Visibility, select an option to indicate who can view packages within the feed.

    If you want to include packages from public sources, select the Use packages from public sources through this feed option.

  4. Select Create when you're done.

    Screenshot that shows selections for creating a new feed in Azure DevOps 2019.

Note

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

Connect to a feed

  1. Sign in to your Azure DevOps organization, and then go 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 pane. If this is your first time using Azure Artifacts with Nuget.exe, ensure that you installed all the prerequisites.

    Screenshot that shows the button for connecting to a feed.

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

    Screenshot that shows onscreen instructions for setting up a project.

  1. Sign in to your Azure DevOps server, and then go 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 pane.

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

    Screenshot that shows onscreen instructions for setting up a NuGet project in Azure DevOps Server 2020 and 2022.

  1. Sign in to your Azure DevOps server, and then go 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 pane.

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

    Screenshot that shows onscreen instructions for setting up a NuGet project in Azure DevOps Server 2019.

Download packages

1. Get the package source URL

  1. Sign in to your Azure DevOps server, and then go 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 pane, and then copy your Package source URL value.

  1. Sign in to your Azure DevOps server, and then go 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 pane, and then copy your Source URL.

    Screenshot that shows a source URL.

2. Set up Visual Studio

  1. In Visual Studio, select Tools > Options.

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

  3. Enter the feed's Name value and the Source URL, and then select the green plus 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 that shows selections for setting up Visual Studio in Windows.

3. Download packages

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

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

    Screenshot that shows selection of a 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

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

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

Examples:

  • Project-scoped feed:

    nuget.exe push -Source https://pkgs.dev.azure.com/myOrganization/MyProject/_packaging/MyFeed/nuget/v3/index.json -ApiKey AZ release/myDemoPackage.1.0.0.nupkg
    
  • Organization-scoped feed:

    nuget.exe push -Source https://pkgs.dev.azure.com/myOrganization/_packaging/myFeed/nuget/v3/index.json -ApiKey AZ release/myDemoPackage.1.0.0.nupkg
    

Note

The ApiKey is required, but you can use any arbitrary value when publishing to Azure Artifacts feeds.