1

Closed

Hierarchical nuget.config doesn't use credentials during package restore

description

I'm trying to get NuGet package restore working from a private HTTPS feed during an automated build on TfsPreview.

AFAIK, there's no NuGet.config or NuGet.exe available in the build account's roaming profile.
I have a local nuget.config in my $(SolutionDir).nuget folder

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="somefeedname" value="https://www.myget.org/F/somefeedname/" />
</packageSources>
<activePackageSource>
<add key="somefeedname" value="https://www.myget.org/F/somefeedname/" />
</activePackageSource>
<apikeys>
<add key="https://www.myget.org/F/somefeedname/" value="MyEncryptedApiKey..." />
</apikeys>
<packageSourceCredentials>
<somefeedname>
  <add key="Username" value="MyUsername" />
  <add key="Password" value="MyEncryptedPassword..." />
</somefeedname>
</packageSourceCredentials>
</configuration>

Below you find the relevant log messages for the error, showing that nuget.exe doesn't seem to have found the required credentials.

Using "Exec" task from assembly "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Exec" (TaskId:11)
Task Parameter:Command="C:\a\src.nuget\nuget.exe" install "C:\a\src\ComponentA\packages.config" -source "https://www.myget.org/F/somefeedname/" -RequireConsent -solutionDir "C:\a\src\ " -verbosity detailed (TaskId:11)
Task Parameter:LogStandardErrorAsError=True (TaskId:11)
"C:\a\src.nuget\nuget.exe" install "C:\a\src\ComponentA\packages.config" -source "https://www.myget.org/F/somefeedname/" -RequireConsent -solutionDir "C:\a\src\ " -verbosity detailed (TaskId:11)
Please provide credentials for: https://www.myget.org/F/somefeedname/ (TaskId:11)
C:\a\src.nuget\nuget.targets(88,5): error : Cannot prompt for input in non-interactive mode. [C:\a\src\ComponentA\ComponentA.csproj]
UserName: (TaskId:11)
C:\a\src.nuget\nuget.targets(88,5): error MSB3073: The command ""C:\a\src.nuget\nuget.exe" install "C:\a\src\ComponentA\packages.config" -source "https://www.myget.org/F/somefeedname/" -RequireConsent -solutionDir "C:\a\src\ " -verbosity detailed" exited with code 1. [C:\a\src\ComponentA\ComponentA.csproj]
Done executing task "Exec" -- FAILED. (TaskId:11)

This makes me think that nuget.exe still looks for credentials in the global nuget.config file.
The weird thing is: I noticed running the exact same restore command works perfectly on my local development machine (empty global nuget config only has pkg restore consent set).
Closed Nov 10, 2012 at 3:46 AM by ClayCompton
Regression testing with the latest 2.2 build reveals no issues.

comments