Deli z drugimi prek


Install NuGet packages with Visual Studio

TFS 2017

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 connect Visual Studio to our feed, 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.

    Connect to feed

  4. Copy your feed's Source URL.

    Copy source URL

Set up Visual Studio

  1. In Visual Studio, select Tools, and then select Options.

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

  3. Enter the feed's Name and Source URL, 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 are done.

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

Install packages from your feed

Now that we set up Visual Studio and added a new package source pointing to our feed, we can now search and install packages from our feed.

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

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

    Select feed source

  3. Use the search bar to look for packages from 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. In Visual Studio, select Tools > NuGet Package Manager > Package Manager Console to open the package manager console.

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