Get started with NuGet packages in Azure Artifacts
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
An Azure DevOps organization and a project. Create an organization or a project if you haven't already.
Install the latest NuGet version.
Install Azure Artifacts Credential Provider.
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.
Azure Artifacts comes pre-installed in TFS 2018. If this is your first time using your feed, you might be prompted to assign a license.
Navigate to your project
http://ServerName:8080/tfs/DefaultCollection/<ProjectName>
.Select Build & Release, and then select Packages.
Select + New feed to create a new feed.
Provide a meaningful Name and Description for your feed. Specify the permissions for who can read and who can contribute, and decide whether to Include external packages.
Select Create when you're done.
Connect to feed
Navigate to your project
http://ServerName:8080/tfs/DefaultCollection/<ProjectName>
.Select Build and Release > Packages.
Select your feed from the dropdown menu.
Select Connect to feed.
Select NuGet, and then follow the instruction to connect to your feed.
Download packages
1. Get the feed's source URL
Select Build and Release, and then select Packages.
Select your feed from the dropdown menu.
Select Connect to feed, and then copy your Source URL.
2. Set up Visual Studio
In Visual Studio, select Tools, and then Options.
Expand the NuGet Package Manager section, and then select Package Sources.
Enter the feed's Name and the Source URL, and then select the green (+) sign to add a source.
If you enabled upstream sources in your feed, clear the nuget.org checkbox.
Select OK when you're done.
3. Download packages
In Visual Studio, right-click on your project, and then select Manage NuGet Packages.
Select Browse, and then select your feed from the Package source dropdown menu.
Use the search bar to search for packages from your feed.
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>