NuGet Package Restore Unable to prompt for credentials with custom feed

后端 未结 1 1025
隐瞒了意图╮
隐瞒了意图╮ 2021-02-09 21:19

I have enabled NuGet Package Restore in my solution. I am using nuget.exe version 2.0.30828.5. For packages that are in the normal public feed, NuGet Package Restore works fine

相关标签:
1条回答
  • 2021-02-09 22:04

    I have this working now. This is what I did to get to get it to work. First, it appears the command:

    NuGet.exe source Update -Name {feedname} -UserName {myusername} -Password {mypassword}
    

    IS the right way to go about it. The caveat is that, when your run the "nuget.exe source Update" command, nuget.exe will look for a NuGet.config file in the same directory as the nuget.exe being executed if it exists. IF it exists, it will store the changes there. If it does NOT exist, it will store the changes in the NuGet.config file located in the %AppData%\NuGet directory.

    The additional caveat is that, when Package Restore gets executed as part of the build, it only looks at the NuGet.config file in the %AppData%\NuGet directory and ignores the NuGet.config file that is in the same directory of the nuget.exe being executed (I'm unsure if this is a bug or intentional).

    So, you should run this command using a nuget.exe that is in a directory that does not have a NuGet.config file in it to ensure the changes get stored in the correct NuGet.config file in the %AppData%\NuGet directory.

    0 讨论(0)
提交回复
热议问题