Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio : NuGet Package Source requires credentials

Visual Studio 2012 > Tools > Options > Package Manager > Package Sources 

I add a new Package Source pointing to a myget.org url :

http://www.myget.org/F/myfeed/

VS > Tools > Library Package Manager > Manage NuGet Packages for Solution... 

I am now prompted for myget credentials. Obviously, it will be inconvenient for developers to have to manually enter credentials every time they work with myget packages.

This blog explains how to store credentials in the machine-level NuGet.config :

https://gist.github.com/xavierdecoster/3205826

but after I follow the steps, VS still prompts me for credentials.

like image 692
BaltoStar Avatar asked Mar 20 '13 22:03

BaltoStar


People also ask

How do I set NuGet credentials in Visual Studio?

Steps: Go to Control Panel -->User Account -->Credential Manager. In window credentials section update the password of your artifactory with encrypted password. In Generic Credential section update your generic password which starts with VSCredential_ prefix with encrypted password.

How do I authenticate a NuGet package?

Some package sources such as nuget.org use API keys for authentication when pushing packages, rather than username/password credentials. Due to limitations in NuGet, this task cannot be used to set up a NuGet service connection that uses an API key. Instead: Configure a secret variable containing the ApiKey.

Where are my NuGet credentials stored?

Globally: to make a credential provider available to all instances of nuget.exe run under the current user's profile, add it to %LocalAppData%\NuGet\CredentialProviders .


1 Answers

One approach is to use the sources command:

nuget.exe sources Add|Update -Name feedName -UserName user -Password secret 

With this you can either add that source with the credentials or update an existing one. It works perfectly.

like image 103
Mike Perrenoud Avatar answered Sep 20 '22 14:09

Mike Perrenoud