Reputation: 2871
Im running a "dotnet restore" in Docker Relevant part of my Nuget.Config looks like this
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="MyNuget" value="https://mynugetsource.com/nuget/v3/index.json" />
</packageSources>
</configuration>
From my Dockerfile
COPY ["NuGet.Config", "myproject.Api/"]
RUN dotnet restore "myproject.Api/myproject.Api.csproj" --configfile nuget.config
One of the packages is "MassTransit" which I get from nuget.org, but the restore operations gives me the error
Failed to download package 'MassTransit.5.5.6' from 'https://mycompanysource.com/.../nuget/v3/flat2/masstransit/5.5.6/masstransit.5.5.6.nupkg'.
The private source have for some reason MassTransit (5.5.5), so Im thinking that confuses things. Can I somehow force nuget to use a specific source for MassTransit? (I need both nuget.org and the private nuget repo)
Upvotes: 6
Views: 4116
Reputation: 305
Had a similar problem but with Asp.net packages. The error I was receiving was 401 Unauthorized. Meanwhile the links to which I was "Unauthorized" led to json result that said that package could not be found.
The package manager was trying to get packages from private feed that supposed to be retrieved from the nuget.org. Thanks to the link provided by the David Dindak I understood that there's some issue with login.
What I did is I first disabled all the package sources from the config. Then lauched a CMD command at my solution folder for each private source one by one:
nuget.exe restore <solution name>
Then I enabled only nuget.org source and restored packages from the Nuget Package Manager.
And finally I could build my solution after two days of hell.
Upvotes: 0
Reputation: 81
After much trial and error with a very similar problem to what you have outlined, I found a potential workaround. Due to a design decision in NuGet, if any source fails to authenticate in your dependency graph your other packages may fail to download. After correcting our auth issue with the private source, the public packages restored successfully.
Are you receiving an authentication error to your private (https://mynugetsource.com/nuget/v3/index.json
) source?
Related: https://github.com/NuGet/Home/issues/6373
Upvotes: 5