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. Artifact feeds can be private to share your packages with your team and specific users, or public to share them publicly with anyone on the internet.

In this article, you'll learn:

  • How to create a new feed
  • How to set up your project and connect to your feed
  • How to publish NuGet packages to your feed
  • How to download NuGet packages from your feed

Prerequisites

Create a feed

You can create two types of feeds: project-scoped and organization-scoped feeds. All public feeds are scoped to their hosting project and they inherit its visibility settings.

  1. Select Artifacts, and then select Create Feed.

    Create a feed button

  2. Give your feed a Name and choose its visibility (who can view packages in this feed), upstream sources, and scope (project-scoped or organization-scoped) settings.

    New feed dialog box

  3. Select Create when you're done.

Note

By default, the Project Collection Build Service (org-scoped) and the project-level Build Service (project-scoped) are set to Collaborator when you create a new feed.

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 https://dev.azure.com/<Your_Organization> and then navigate to your project.

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

  3. Select Connect to feed.

    Connect to your feed

  4. Select NuGet.exe.

    NuGet.exe feed connection

  5. If this is the first time using Azure Artifacts with Nuget.exe, select Get the tools and follow the instructions to:

    1. Install the latest NuGet version.
    2. Install Azure Artifacts Credential Provider.
  6. Follow the instructions in the Project setup to add a nuget.config file.

    Project setup

  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.

    Connect to feed - TFS

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

    Connect to NuGet feed - TFS

Publish NuGet packages

Run the following command in an elevated command prompt window to set up your nuget.config file and publish your NuGet package to your feed. See nuget sources, and nuget push for more details:

nuget sources add -Name <SourceName> -Source <SourceURL> -username <UserName> -password <Pat>
nuget push -Source <SourceName> -ApiKey key <PackagePath>

If you don't have a NuGet package but want to try publishing packages to your feed, you can install the HelloWorld sample package as follows:

nuget install HelloWorld -ExcludeVersion

Download NuGet 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.

    A screenshot highlighting the Connect to feed button.

  3. Select Visual Studio from the left navigation panel.

  4. Copy your feed's 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.

    A screenshot showing how to Connect to feed in TFS.

  4. Copy your feed's 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 check box.

  5. Select OK.

    Set up visual studio: 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 drop-down menu. Select feed source
  3. Use the search bar to look for packages from your feed.

Note

Searching for packages in upstreams with NuGet Package Explorer is not supported.