Edit

Share via


Publish and download NuGet packages with Azure Artifacts

Azure DevOps Services | Azure DevOps Server 2022 | Azure DevOps Server 2020

Azure Artifacts enables developers to publish and download NuGet packages from feeds or public registries. Feeds can be either private, allowing you to share packages with specific users, or public, making your packages accessible to anyone on the internet.

This article guides you through creating a feed, configuring your project, and publishing and downloading NuGet packages.

Prerequisites

Product Requirements
Azure DevOps - An Azure DevOps organization.
- An Azure DevOps project.
- Download and install the Azure Artifacts Credential Provider.
- Install the latest NuGet version.

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.

Note

By default, the Build Service for the project (for example: projectName Build Service (orgName)) is assigned the Feed and Upstream Reader (Collaborator) role when a new feed is created.

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 navigation pane. If this is your first time using Azure Artifacts with Nuget.exe, make sure you've installed the prerequisites.

  4. Follow the provided instructions under the Project setup section to set up your nuget.config file and connect to your Azure Artifacts feed.

    A screenshot displaying how to set up your project and connect to your 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 your feed from the dropdown menu.

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

  4. Follow the provided instructions under the Project setup section to set up your nuget.config file and connect to your Azure Artifacts feed.

    A screenshot displaying how to set up your project and connect to your feed in Azure DevOps Server 2020 and 2022.

Publish packages to your feed

To publish a package to your feed, run the following command. The ApiKey parameter is required, but you can use any arbitrary string as its value.

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.

Download packages from your feed

To restore packages from your feed, run the following command in your project directory:

nuget.exe restore

Note

Searching for packages in upstream sources using the NuGet Package Explorer is not supported.