Dela via


Install NuGet packages with Visual Studio

TFS 2018

Using Azure Artifacts and Visual Studio, you can set up your development machine to access and install packages from your feeds and public registries such as NuGet.org.

Get source URL

To set up Visual Studio to access your feed as a package source, we must first get 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, and then copy your Source URL.

    A screenshot showing the package source URL in TFS.

Set up Visual Studio

  1. Open Visual Studio, and then select Tools > Options.

  2. Select NuGet Package Manager, and then select Package Sources.

  3. Enter your feed's Name and the Source URL you copied in the previous step, and then select the green (+) sign to add a new package source.

  4. If you enabled upstream sources in your feed, clear the nuget.org checkbox.

  5. Select OK when you're done.

    Screenshot showing how to add a new package source in Visual Studio - Windows

Install packages from your feed

Now that you set up Visual Studio and added a new package source pointing to your feed, you can now search and install packages right from Visual Studio package manager.

  1. Open Visual Studio, and then right-click on your project in the Solution Explorer, then select Manage NuGet Packages....

  2. Select Browse, and then select your feed from the Package source dropdown menu.

    A screenshot showing the package source dropdown menu in Visual Studio.

  3. Use the search bar to look for packages in your feed.

Note

If you enabled upstream sources, any packages that haven't been saved to your feed (by using them at least once) won't appear in the search result.

Install packages from NuGet.org

  1. Navigate to NuGet.org and search for the package you want to install.

  2. Select Package Manager, and then copy the Install-Package command.

  3. Open Visual Studio, and then select Tools > NuGet Package Manager > Package Manager Console to open the package manager console.

  4. Paste the install command into the Package Manager Console and then press Enter.