Install NuGet packages with Visual Studio
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
This article guides you through setting up your Visual Studio to install NuGet packages from Azure Artifacts feeds and NuGet.org.
Prerequisites
Product | Requirements |
---|---|
Azure DevOps | - An Azure DevOps organization. - An Azure DevOps project. - An Azure Artifacts feed. |
Other | - Download Visual Studio. |
Get the source URL
Before setting up Visual Studio, you must first get your feed's source URL. You'll use this URL in the next section to add your feed as a package source in Visual Studio:
Sign in to your Azure DevOps server, and then navigate to your project.
Select Artifacts, select your feed from the dropdown menu, and then select Connect to Feed.
Select NuGet from the left navigation pane, then copy your Package source URL.
Sign in to your Azure DevOps organization, and then navigate to your project.
Select Artifacts, select your feed from the dropdown menu, and then select Connect to Feed.
Select Visual Studio from the left navigation pane, then copy your Source URL.
Set up Visual Studio
Now that you have your feed's source URL, follow these steps to set up Visual Studio and add the new package source:
Open Visual Studio, then select Tools > Options.
Select NuGet Package Manager, and then select Package Sources.
Enter your feed's Name and paste the Source URL you copied earlier. Select the green (+) icon when you're done to add a new package source.
If you've enabled upstream sources in your feed, uncheck nuget.org.
Select OK when you're done.
Install packages from a feed
Now that you've set up Visual Studio and added your feed as a package source, you can now search and install packages directly from the NuGet Package Manager in Visual Studio.
Open Visual Studio, and then right-click on your project in the Solution Explorer, then select Manage NuGet Packages....
Select Browse, and then select your feed from the Package source dropdown menu.
Use the search bar to find and install packages from your feed.
Note
If you've enabled upstream sources, packages that haven't been saved to your feed from upstream won't appear in search results. A package is saved to the feed when a Feed and Upstream Reader (Collaborator) or higher installs it from upstream.
Install packages from NuGet.org
You can install packages from NuGet.org in several ways, one of which is by using the Package Manager Console in Visual Studio:
Navigate to NuGet.org and search for the package you want to install.
Select the Package Manager tab, and then copy the Install-Package command.
Open Visual Studio, then select Tools > NuGet Package Manager > Package Manager Console.
Paste the install command into the console and press Enter.