dotnet restore doesn't send any credentials if a user-level nuget.config has the same source as a project-level config, and the credentials are specified in the project-level config but not in the user-level config. NuGet.exe does not appear to have this bug.
Apologies if this is a dupe, but there are so many nuget/dotnet auth issues to look through, and it wasn't obvious if there was an exact match.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="test" value="https://<redacted>.pkgs.visualstudio.com/_packaging/test/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<test>
<add key="Username" value="<redacted>" />
<add key="ClearTextPassword" value="<redacted>" />
</test>
</packageSourceCredentials>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="test" value="https://<redacted>.pkgs.visualstudio.com/_packaging/test/nuget/v3/index.json" />
</packageSources>
</configuration>
NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): dotnet
NuGet version (x.x.x.xxx): 4.8.0.6 (as reported by dotnet nuget --version)
dotnet.exe --version (if appropriate): 2.1.400
OS version (i.e. win10 v1607 (14393.321)): Windows Server 2016
@zarenner Probably a duplicate of this.
https://github.com/NuGet/Home/issues/3580
You mentioned that it works with nuget.exe but not with dotnet.exe?
Those specific code paths should be united normally.
//cc @PatoBeltran
This might be related to how the configs are merged, but I have not investigated.
//cc @rrelyea for visibility.
ETA on this being fixed?
This has been solved as part of the latest rework on the nuget.configuration code paths.
Short question: is that bugfix already released because I still have the problem if I try to consume a NuGet package from a private VSTS source
This was likely fixed in 4.9.0
However, if it missed that train, it definitely should be in 5.0.0-preview2.
Most helpful comment
@zarenner Probably a duplicate of this.
https://github.com/NuGet/Home/issues/3580
You mentioned that it works with nuget.exe but not with dotnet.exe?
Those specific code paths should be united normally.
//cc @PatoBeltran
This might be related to how the configs are merged, but I have not investigated.
//cc @rrelyea for visibility.