VSTS NuGet package feed authentication

2019-05-28 16:32发布

问题:

I'm currently setting up a VSTS account and have been testing a build that packs and pushes a NuGet package to the VSTS packages feed.

I've added the feed url (https://mycompany.pkgs.visualstudio.com/.../v3/index.json) to the Visual Studio "Package Sources" settings, but when I go into (say) the "Manage NuGet Packages for Solution" dialog I am prompted for a username and password.

I've tried downloading the credential provider (CredentialProvider.VSS.exe) from VSTS and have copied it to %LocalAppData%\NuGet\CredentialProviders as detailed here, but I'm still seeing the authentication popup.

What am I missing or doing wrong? I'm using VS2013 and NuGet v3.3, if that makes a difference.

回答1:

Visual Studio 2015 Update 1 and later have built-in support for VSTS feeds.

For Visual Studio 2013, you'll need to manually manage a Personal Access Token in a NuGet.config file. From a command prompt, you can run nuget.exe sources add -name {your feed name} -source {your feed URL} -username {anything} -password {your PAT}. Then, restart Visual Studio and you should be able to access your feed.