I have a private nuget server which I am trying to pull packages from (eventually Azure build agent but I am trying this locally first).
I am using the 2.7 NuGet meaning I do not need .NuGet folder (along with .exe and .targets). I have a nuget.config in my solution directory.
I know the nuget.config is being picked up, as it locates my remote repository but the credentials supplied in the config are not used.
Here is my config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSources>
<add key="https://www.nuget.org/api/v2/" value="https://www.nuget.org/api/v2/" />
<add key="myrepo" value="http://myrepo:81/nuget/myfeed" />
</packageSources>
<disabledPackageSources />
<packageSourceCredentials>
<myrepo>
<add key="Username" value="user" />
<add key="ClearTextPassword" value="pass" />
</myrepo>
</packageSourceCredentials>
</configuration>
What would cause nuget to ignore these credentials? I have checked with Fiddler and no credentials are being sent, and the server responds with a 401 (correctly):
Error 1 NuGet Package restore failed for project MyProject: The remote server returned an error: (401) Unauthorized.. 0 0
Use the 'Manage NuGet Packages' dialog ! Do not rely on building/rebuilding in Visual Studio expecting that it will restore the missing packages. Open the 'Manage NuGet Packages' for a project (right click on a failing project and choose the option) and you will see a message "Some packages are missing for this project..." with a 'Restore' button. Restoring using that button will resolve these authentication issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With