Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Non-interactive NuGet Restore impossible for ProGet private feeds
-
Hi,
We've set up a ProGet repository in our organization and created a private feed there that stores our internal packages.
Correct username and password has to be sent to ProGet to get access there.Now, as a part of our CI build, I need to perform NuGet Restore that gets packages from official NuGet feed and/or from our internal ProGet feed. But I can't make it work non-interactively, without the need to manually enter username and password - which is obviously a must for CI process.
Main nuget.config file contains correct feed url (http://nuget.ourCompany.org/nuget/Corporate), username and password.
I run this console command: nuget.exe Restore OurSolution.sln -Verbosity detailed
Sample output for a package from official NuGet feed:
GET https://www.nuget.org/api/v2/Packages(Id='AutoMapper',Version='2.2.1') Installing 'AutoMapper 2.2.1'. GET https://www.nuget.org/api/v2/package/AutoMapper/2.2.1 Successfully installed 'AutoMapper 2.2.1'. All packages listed in packages.config are already installed.
Sample output for a package from ProGet private feed:
Using credentials from config. UserName: Developer GET http://nuget.ourCompany.org/nuget/Corporate/Packages(Id='OurPackage',Version='1.0.2') Installing 'OurPackage 1.0.2'. GET http://nuget.ourCompany.org/api/v2/package/Corporate/OurPackage/1.0.2 Please provide credentials for: http://nuget.ourCompany.org/api/v2/package/Corporate/OurPackage/1.0.2 UserName:
And now NuGet.exe expects to read username and password from console input, even though it successfully used nuget.config credentials before.
I've done some debugging in nuget.exe and it turns out that this error is caused by this difference in urls:
GET http://nuget.ourCompany.org/nuget/Corporate/Packages(Id='OurPackage',Version='1.0.2') GET http://nuget.ourCompany.org/api/v2/package/Corporate/OurPackage/1.0.2
Feed url is http://nuget.ourCompany.org/nuget/Corporate, and NuGet doesn't match username/password for it to url http://nuget.ourCompany.org/api/v2/package/...
NuGet would work correctly if ProGet feed url would be like http://nuget.ourCompany.org/api/v2/ or http://nuget.ourCompany.org/api/v2/Corporate, but then ProGet doesn't work.
So my general question is: How to make non-interactive NuGet Restore for a private ProGet feed?
And my specific question is: How to expose ProGet feed with url starting with http://.../api/v2/ , like in official nuget feed (https://www.nuget.org/api/v2/)?
Product: ProGet
Version: 3.0.3
-
NuGet should already support the -NonInteractive flag when attempting to restore the package, can you add that and see if that helps?
-
Setting that flag just makes nuget.exe to throw exception when trying to prompt for credentials:
System.InvalidOperationException: Cannot prompt for input in non-interactive mode.
-
In this case, you'll need to put credentials in the nugget.config file.
-
Hello
I am having the same problem that has been described before
I have a ProGet Chocolatey private feed, which I am using for artifacts built with Team City.
I have added the credentials for the feed "http://178.33.163.75:81/nuget/Artifacts" in the nuget.config.
Also, please notice that nuget says it's using the credentials from config.
But then it asks for the credentials for a completely different url "http://178.33.163.75:81/api/v2/package/Artifacts
/jobplatform_service/0.0.0.79"And since I am in NonInteractive mode, this will fail
This is the nuget command I enter:
C:\ProgramData\chocolatey\chocolateyinstall>nuget install jobplatform_service -v
ersion 0.0.0.79 -source http://178.33.163.75:81/nuget/Artifacts -NonInteractiveThis is the result:
Using credentials from config. UserName: TCDeploy
Please provide credentials for: http://178.33.163.75:81/api/v2/package/Artifacts
/jobplatform_service/0.0.0.79
UserName: Cannot prompt for input in non-interactive mode.How can I configure the credentials for this feed?
Thanks a huge lot
-
I am using password from nuget.config.
And as pointed by Pawel, password is being supplied when calling GET http://nuget.ourCompany.org/nuget/Corporate/Packages(Id='OurPackage',Version='1.0.2')but no password is supplied when calling GET http://nuget.ourCompany.org/api/v2/package/Corporate/OurPackage/1.0.2
Any solutions ? or work arounds.
FYI: I tried adding adding credentials in packageSourceCredentials for http://nuget.ourCompany.org/api/v2/package/Corporate/ or http://nuget.ourCompany.org/api/v2/
Still no luck.
Any help would be great!
Thanks
Manish
-
This is, unfortunately, a bug in the NuGet client (v2.8.2 has it, as do various others).
There is no workaround, aside from getting the "CI build" of NuGet tools or using an older version without this bug.
-
Thanks Alana. moving back to an older version of Nuget.exe works
-
I'm having the same problem but reverting to 2.8.1 did not help.
-
I upgraded ProGet to current 3.4.5 from 3.3.11 and that fixed the problem.
-
Which older version of nuget works correctly?