I have included NuGet Package recovery in my solution. I am using nuget.exe version 2.0.30828.5. For packages that are in a regular public channel, NuGet Package Restore works fine. That is, if there is nothing in the Packages directory and my local NuGet cache (C: \ Users \ {username} \ AppData \ Local \ NuGet \ Cache) is clear, NPR works fine.
However, when we try to use NPR for the package in our custom feed (the user feed has basic authentication), we get the following:
EXEC : warning : Unable to prompt for credentials. Consult NuGet help documentation for ways to specify credentials. c:\<localpath>\.nuget\nuget.targets(80,9): error : Unable to find version '2.0.1.0' of package '<packageName>'. c:\<localpath>\.nuget\nuget.targets(80,9): error MSB3073: The command ""c:\<localpath>\.nuget\nuget.exe" install "c:\<localpath>\packages.config" -source "" -RequireConsent -o "c:\<localpath>\packages"" exited with code 1.
When I look at the NuGet code and also decompile nuget.exe to find the line βCannot request credentials. Refer to the NuGet help documentation on how to specify credentials.β I see this there, but honestly, I canβt determine who uses this error message.
When we add a package (either from the NuGet UI or from the package manager console), it asks for credentials and works fine. This is a problem only when restoring packages.
I tried to execute this command:
NuGet.exe source Update -Name {feedname} -UserName {myusername} -Password {mypassword}
but gets the same result.
Does anyone know how I can specify credentials for a custom NuGet channel using Basic auth to restore a NuGet package?
UPDATE 9/18/2012
I have an update on this issue. I noticed that when I ran the nuget.exe Update Update ... command, it added a section to the NuGet.config file, which was in the local .nuget folder for my solution. Then I ran procmon.exe while starting the build, noticing that this file was not being viewed! Instead, he searched for the NuGet.config file in the directory "C: \ Users {username} \ AppData \ Roaming \ NuGet". Then I copied / pasted the section from the local NuGet.config file to the NuGet.config file in the \ AppData \ Roaming \ NuGet directory and it works!
So ... the question is, what is the right best practice for this process?