dotnet restore fails when using nuget proxy on nex

2020-06-12 02:58发布

问题:

I have a nuget proxy on Nexus (v 3.9.0-01) on an internal network. I haven't populated the local Nexus repo myself (and don't know how it was done or if any issues arose), however, I can upload new packages manually. The build takes place on Bamboo agent and cannot be connected to the public repository.

Because of the isolation, I have to run dotnet build / dotnet publish with --no-restore and restore the packages using dotnet restore $projectPath --source $localNexus --runtime win-x64

The packages are being restored just fine until NuGet.Frameworks.4.7.0. This package exists in 5 different versions (as far as I can tell exact copy of the official nuget repo), just not plain 4.7.0 (which doesn't exist in the official repo either). Then, dotnet restore produces the following output:

build   20-Jun-2018 16:24:26    info :   GET https://nexus.***.***.***.au/repository/nuget.org-proxy/Microsoft.CodeAnalysis.Workspaces.Common/2.8.0
build   20-Jun-2018 16:24:27    error: The feed 'https://nexus.***.***.***.au/repository/nuget.org-proxy/ [https://nexus.***.***.***.au/repository/nuget.org-proxy/]' lists package 'NuGet.Frameworks.4.7.0' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.
build   20-Jun-2018 16:24:27    error:   Unable to find package 'NuGet.Frameworks.4.7.0'.

The restore operation fails even if I force the package using dotnet add $projectPath package --source $localNexusbefore runningdotnet restore`.

Note: this package is a dependency of Microsoft.VisualStudio.Web.CodeGeneration.Design in my project.

Possibly related: https://issues.sonatype.org/browse/NEXUS-6159 (tagged with different Nexus version)

Questions:

  • Why is the package restore failing (i.e. not pulling the most suitable 4.7.0-xxx)?
  • Is it due to some Nexus quirks? Or corrupted package?
  • Why does it not help to add the problematic package manually using dotnet package add?

回答1:

Having the exact same problem with Nexus 3.10, it appears this is resolved in 3.14 according to this Nexus issue; https://issues.sonatype.org/browse/NEXUS-17611