Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Package Source is not prompting for credentials

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

like image 831
Yan Germanovich Avatar asked Aug 21 '17 13:08

Yan Germanovich


People also ask

How do I refresh NuGet credentials?

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

Where are 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 .


4 Answers

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.

Image of Windows Credential Manager with nuget and github entries

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:

  • https://support.microsoft.com/en-us/help/4026814/windows-accessing-credential-manager (I found this via: https://developercommunity.visualstudio.com/content/problem/98692/nuget-package-source-is-not-prompting-for-credenti.html)
like image 132
SymboLinker Avatar answered May 04 '23 16:05

SymboLinker


This is riddiculous that it does not prompt for credentials.

To make it work I had to do the following:

  1. Download nuget.exe from Nuget download site

  2. Remove my old package source

    Go to NuGet Package Manager for Solution->Settings

enter image description here

Delete your Package Source

enter image description here

  1. Run Command Line

    Go to nuget.exe

enter image description here

  1. Add package source with plain password in the command

    nuget.exe sources Add -Name "YourPackageName" -Source "YourPackageAddress" -Username YourUserName -password YourPassword -StorePasswordInClearText

enter image description here

  1. Done... phew
like image 34
pawciu Avatar answered May 04 '23 16:05

pawciu


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

like image 20
Ziv Weissman Avatar answered May 04 '23 16:05

Ziv Weissman


Remove the source from the Nuget Package Manager and add it with a new name.

like image 33
Jean-Simon Collard Avatar answered May 04 '23 14:05

Jean-Simon Collard