问题
Whenever I update my NuGet packages in Visual Studio, I am prompted for a username and password regarding a private NuGet feed.
Despite me ticking the box [✓] Remember my password, I am prompted to enter password on subsequent NuGet updates.
How can I make it remember my password properly?
回答1:
This is a prompt from Visual Studio and not NuGet. Information entered here is not saved with NuGet. Although it should be cached for the current Visual Studio session.
NuGet stores user names and passwords in its NuGet.Config file. You can save usernames and passwords for protected feeds by adding them to the NuGet.Config file using the nuget.exe command line.
NuGet.exe Sources Update -Name <feedName> -Source <pathToPackageSource> -UserName xxx -Password <secret>
If this is a prompt for a proxy then you can either set it using nuget:
NuGet.exe config -Set HTTP_PROXY=http://127.0.0.1 -Set HTTP_PROXY.USER=domain\user
Or use an environment variable http_proxy with the value specified in the format http://[username]:[password]@proxy.com
来源:https://stackoverflow.com/questions/35938986/private-nuget-feed-remembering-password