Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    proget
    11 Posts 1 Posters 13 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        NuGet should already support the -NonInteractive flag when attempting to restore the package, can you add that and see if that helps?

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          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.
          
          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            In this case, you'll need to put credentials in the nugget.config file.

            https://docs.nuget.org/docs/reference/nuget-config-settings

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

              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 -NonInteractive

              This 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

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • ? This user is from outside of this forum
                  Guest
                  last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • ? This user is from outside of this forum
                    Guest
                    last edited by

                    Thanks Alana. moving back to an older version of Nuget.exe works

                    1 Reply Last reply Reply Quote 0
                    • ? This user is from outside of this forum
                      Guest
                      last edited by

                      I'm having the same problem but reverting to 2.8.1 did not help.

                      1 Reply Last reply Reply Quote 0
                      • ? This user is from outside of this forum
                        Guest
                        last edited by

                        I upgraded ProGet to current 3.4.5 from 3.3.11 and that fixed the problem.

                        1 Reply Last reply Reply Quote 0
                        • ? This user is from outside of this forum
                          Guest
                          last edited by

                          Which older version of nuget works correctly?

                          1 Reply Last reply Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            Last post
                          Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation