- 30 Dec 2021
- 3 Minutes to read
HOWTO: Add ProGet as Package Source in Visual Studio
- Updated on 30 Dec 2021
- 3 Minutes to read
How To Add ProGet As A NuGet Package Manager In Visual Studio
Connecting ProGet to Visual Studio is a great way to boost security on the most commonly used integrated development environment for Windows-first developers. ProGet acts as a NuGet Package Manager for Visual Studio, since ProGet can detect package licenses, scan packages for vulnerability, and control promotion between feeds.
This guide will describe how to connect Visual Studio and ProGet, as well as how to set up authentication on a ProGet-connected NuGet feed in Visual Studio.
To get started, you’ll need a NuGet feed already set up in ProGet. We recommend reading our guide about approving and promoting packages too.
Step 1: In ProGet, copy your API Endpoint URL
Navigate to the top of your desired feed and copy the API Endpoint URL from the top right of the page.
Step 2: In Visual Studio, open Package Manager Settings
Navigate Tools > NuGet Package Manager > Package Manager Settings
Step 3: Disable nuget.org in your Package Manager Settings
Uncheck the box to the left of nuget.org
This will prevent Visual Studio from searching both NuGet.org and ProGet for packages. By configuring Visual studio to just ProGet, instead of NuGet.org and ProGet, you avoid problems like bad licenses, vulnerabile packages, and dependency confusion in your packages when using multiple sources.
Step 4: Create a new package source
- Click on the green + in the top right of the window.
- Name the new package source.
- Paste in your API endpoint URL from Step 1
Step 5: Save your package source configuration
- Click the [Update] button.
- Click the [OK] button.
Visual Studio and ProGet are now connected.
If you click [OK] without clicking [Update] your package source configuration will not be saved in Visual Studio.
Step 6: Check the connection
To confirm the connection, in Visual Studio, right-click on a project in the Solution Explorer and select “Manage NuGet Packages…” from the menu.
In the Package Manager window, your feed will populate under “Browse”
Adding Authentication to a NuGet Feed
Teams may require authentication for feeds in ProGet, which will require users to login to thier package source in ProGet. To do so, follow these steps:
Step A: In ProGet, remove anonymous access from ProGet
Before you can set up an authenticated feed in Visual Studio, you’ll need to be logged in as an administrator in ProGet.
Once logged in, navigate Settings > Users and Tasks > Tasks
In ProGet, anonymous is an administrator by default. This is done to help the initial set-up of ProGet in a server. If you haven't done so already, remove anonymous access.
Then, remove the other permissions anonymous has like viewing and downloading from a feed.
Read our guide on restrictions and permissions to learn more granular details about users and tasks.
Step B: Create a Personal API Key
Under the user icon in the top-right of ProGet, select “Personal API Keys”
At the bottom of the page, click [Create Personal API Key]
In the pop-up, type an appropriate display name and click [Create API Key]
Then, click on the display name and the pop-up will appear again, this time with the Personal API key generated.
Copy the Personal API key for Step C.
Step C: In Visual Studio, connect to the server
Repeat Step 6 above and check the connection. This time, a pop-up will appear asking to connect to the server.
Type in “api” for the user name.
Paste in the Personal API key from Step B for the password.
You’ve now configured an Authenticated NuGet feed in Visual Studio.
An error may occur when trying to browse the authenticated NuGet feed in Visual Studio.
The window will not populate packages, and the error list will say “API Key … does not exist.”
It’s possible there was an error in inputting the Personal API Key while connecting to the server, or the API key was deleted in ProGet.
To resolve, in Visual Studio, close all your instances.
Then, in Windows, open Control Panel and navigate to Credential Manager.
Under Windows Credentials, delete the one named as the ProGet host (in this demonstration, 126.96.36.199)
Under Generic Credentials, find and remove the one named “VSCredentials_
Now, In Visual Studio open your instance and navigate to the Package Manager again like in Step 6.
You will be prompted again to enter a Personal API key, like in Step C.
Repeat Step C to reconnect to the authenticated NuGet feed.