Visual Studio : NuGet Package Source requires credentials

40,995

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.

Share:
40,995

Related videos on Youtube

BaltoStar
Author by

BaltoStar

Updated on March 06, 2020

Comments

  • BaltoStar
    BaltoStar about 4 years
    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.

    • Sumo
      Sumo about 11 years
      Is this your issue? nuget.codeplex.com/workitem/2114
    • Xavier Decoster
      Xavier Decoster about 11 years
      If no proxy involved, feel free to share a sanitized fiddler trace.
    • Pavel Veller
      Pavel Veller over 9 years
      I guess I am having the same issue and from what I can tell from Fiddler VS 2012 doesn't sent Authentication header unless I supply credentials via its "login" dialog. Almost as if it ignores the packageSourceCredentials section (doesn't matter if it's in the global NuGet.config of the one within the solution)
  • Patrick
    Patrick almost 9 years
    The problem I have run into with this, is that it is not smart enough to apply those credentials to everything after the registered url. Example, if you set username/pwd to source url of my.nuget.org/local, it will work perfectly. However if you try to push to my.nuget/org/local/common, it will prompt you for your credentials again. I wish there was a way to register a url with a wildcard at the end or set global credentials that would be used by default for all registered sources. This currently encourages people to just dump everything in one folder.
  • Tim Schmidt
    Tim Schmidt about 8 years
    This is the exact problem I'm seeing with a private repo. Still no way to fix this?
  • Preet Sangha
    Preet Sangha over 7 years
    That link doesn't have any mention of credentials
  • jhhwilliams
    jhhwilliams over 2 years
    This is what I needed to add credentials to an existing NuGet source in GitHub Actions