Consume NuGet packages in Visual Studio

Note

Support for NuGet packages is available with Package Management in VSTS and TFS 2017 and newer.

To consume NuGet packages from a feed, add the feed's NuGet endpoint as a package source in Visual Studio.

Note

Package Management feeds work seamlessly with the NuGet Package Manager for Visual Studio 2015 extension as of Visual Studio 2015 Update 1. If you haven't installed Update 1 or later, you can update to the latest version of the NuGet Package Manager extension directly. Using Visual Studio for Mac? See this guidance.

Get your feed's NuGet package source URL

Navigate to your feed (or create a feed if you haven't). Then, select Connect to feed:

Connect to feed button in the upper-right of the page

Next, copy the NuGet package source URL:

NuGet Package source URL in the Connect to feed dialog

Windows: Add the feed to your NuGet configuration

  1. On the Tools menu, select Options....
  2. Expand NuGet Package Manager and select Package Sources.
  3. Click the green plus in the upper right corner.
  4. At the bottom of the dialog, enter the feed's name and the URL you got in the last step.
  5. Select Update and then OK.

Add new NuGet source

Then click here to continue.

Mac: Add the feed to your NuGet configuration

  1. Get a Personal Access Token (PAT) and make a note of it.
  2. Open the Preferences dialog from the Visual Studio menu in the menu bar.
  3. Select NuGet -> Sources.
  4. Click Add then enter your feed's name, URL, any username, and your PAT as the password.
  5. Click OK, then OK again.

Visual Studio for Mac preferences window with VSTS feed added

Consume packages

You can now discover and use packages in this feed. To add a package reference to a project:

  1. Find your project in Solution Explorer.
  2. Right-click References.
  3. Select Manage NuGet Packages....
  4. In the Package source dropdown, select your feed.
  5. Look for your package in the list.

Select feed source

Using Visual Studio 2015 or earlier?

You may need to download and install the latest NuGet Package Manager extension.

Using Visual Studio 2013 or earlier?

You'll need to get a Personal Access Token. When you're prompted for a username and password, use any username and your PAT as the password.