Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet restore fails when using nuget proxy on nexus

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?
like image 898
Michal Avatar asked Jun 20 '18 12:06

Michal


People also ask

Does Nexus support NuGet?

With the release of version 2.9, NuGet support is available in Nexus Repository Manager Pro and Nexus Repository Manager OSS.

Does dotnet restore use NuGet?

The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file.

What is the difference between NuGet restore and dotnet restore?

nuget restore will ensure all of your NuGet dependencies are downloaded and available to your project. Whereas dotnet restore is a complete restoration of all NuGet dependencies as well as references and project specific tools. Meaning that if you run nuget restore , you are only restoring NuGet packages.

How do I clean and restore a NuGet package?

Restore NuGet packagesNavigate to Tools > Options > NuGet Package Manager > General, and then select the Allow NuGet to download missing packages check box under Package Restore. Enabling Restore NuGet Packages. In Solution Explorer, right-click the solution, and then select Restore NuGet Packages.


1 Answers

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

like image 150
Keith D Avatar answered Sep 27 '22 20:09

Keith D