I've added a NuGet Source. It needs credentials but when I'm installing a package using install-package packageName nothing happens. I tried the same steps on other PC and it works. I'm using Visual Studio 2017 Professional. Could someone please help me with the issue? My NuGet sources
-
is nuget.org/api/v2 your added NuGet Source? How about change it to https ://api.nuget.org/v3/index.json (Remove the space in the link) and have you try to install the package from Manage NuGet Package UI? Could you provide some detail steps to us to reproduce this issue? Some screenshots would be better. – Leo Liu Aug 23 '17 at 06:35
-
Having the same issue. Trying to update from a team nuget source, password protected. Usually there suppose to be a screen that prompts username + password but it doesn't show up and i get 401 error unauthorized. @Leo-MSFT – Ziv Weissman Oct 03 '17 at 11:07
6 Answers
This is riddiculous that it does not prompt for credentials.
To make it work I had to do the following:
Download nuget.exe from Nuget download site
Remove my old package source
Go to NuGet Package Manager for Solution->Settings
Delete your Package Source
Run Command Line
Go to nuget.exe
Add package source with plain password in the command
nuget.exe sources Add -Name "YourPackageName" -Source "YourPackageAddress" -Username YourUserName -password YourPassword -StorePasswordInClearText
- Done... phew

- 855
- 9
- 15
-
The nuget.config file is located %AppData%\nuget in case you want to take a look at the entries and details. – Satchi Jul 23 '18 at 19:22
-
I've upped this because it works. But i gotta say that storing your password in clear text is not safe. So please use the command but omit the "-StorePasswordInClearText" parameter. Not sure why nuget created such parameter, it is bad practice imo. – Bowo Aug 21 '23 at 02:02
If Visual Studio does not prompt for credentials but the logging Output shows that you did not authenticate correctly, then go to
Control Panel\User Accounts\Credential Manager
and click "Windows Credentials". You can remove stored credentials for nuget/github there. If they become invalid - for example because you regenerated a token - Visual Studio does not prompt to overwrite the invalid credentials, but after removing the credentials and restarting Visual Studio you do get the prompt.
I've documented more troubleshooting related to the NuGet.Config in this issue: https://github.com/verybadcat/CSharpMath/issues/168
Source for solving this specific problem:

- 884
- 6
- 15
-
4It should be mentionned that Visual Studio should be restarted after doing this; seems like it caches things in memory. – Etienne de Martel Sep 22 '21 at 18:44
-
@Etienne de Martel: thanks - I’ve included your contribution in my answer. – SymboLinker Sep 23 '21 at 19:58
After many attempts to set password, reset password or whatever the only thing that helped me was adding this section to the NuGet.Config (located on the .nuget folder for the main solution)
NuGet.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="false" />
</solution>
<packageSourceCredentials>
<MySourceName> <!-- Name of nuget package source -->
<add key="Username" value="..." />
<add key="ClearTextPassword" value="..." /> <!-- This is for normal password-->
<!--if encrypted use key="Password"-->
</MySourceName>
</packageSourceCredentials>
</configuration>
One important notice - for any change to this file to take effect I had to restart VS

- 4,400
- 3
- 28
- 61
Remove the source from the Nuget Package Manager and add it with a new name.

- 591
- 5
- 4
Credentials popup might be not coming because you have earlier entered some other credentials or some other credentials is stored against the NuGet Package. You can goto Credentials Manager in your PC and check for all NuGet Credentials. If you found any, Please remove them from there. And, then try to restart Visual Studio and enter the package source and Url again. This time you will get the popup to add credentials for sure.

- 121
- 6
If neither the Credential Manager solution, the Package Manager solution or the NuGet Update command solution work for you, try deleting everything under
\HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\VssApp
That should get it to ask for credentials again.

- 763
- 1
- 8
- 25