NuGet feed fails to restore with PackageReference

Answered

TeamCity Professional 2021.1 (build 92597)

We are seeing that some of the libraries in our feed are failing to restore when using the new PackageReference style of NuGet dependencies. NuGet will attempt to read the index of the metadata before attempting to download the nupkg file resulting in an error. 

In the screen shot below is an example of a hosted nuget package in our teamcity instance showing the available versions.

The snippet below shows the output of the error for the package manager in Visual Studio.

Restoring packages for C:\Users\xxxx\source\repos\post-worker\PhoenixET.EDX.Services.PostWorker\PhoenixET.EDX.Services.PostWorker.csproj...
GET https://api.nuget.org/v3-flatcontainer/phoenixet.edx.utilities/index.json
GET https://xxx.xxx.com/httpAuth/app/nuget/feed/_Root/default/v3/flatcontainer/phoenixet.edx.utilities/index.json
NotFound https://api.nuget.org/v3-flatcontainer/phoenixet.edx.utilities/index.json 791ms
NotFound https://xxx.xxx.com/httpAuth/app/nuget/feed/_Root/default/v3/flatcontainer/phoenixet.edx.utilities/index.json 903ms
NU1101: Unable to find package PhoenixET.EDX.Utilities. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org, PhoenixET
System.InvalidOperationException: Unable to find metadata of PhoenixET.EDX.Utilities.1.0.0.64
at NuGet.PackageManagement.UI.UIActionEngine.<GetPackageMetadataAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.UI.UIActionEngine.<CheckLicenseAcceptanceAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at NuGet.PackageManagement.UI.UIActionEngine.<>c__DisplayClass11_0.<<PerformActionImplAsync>b__0>d.MoveNext()
Time Elapsed: 00:00:02.7445330
========== Finished ==========

Digging into the NuGet feed itself I see that when https://xxx.xxx.com/httpAuth/app/nuget/feed/_Root/default/v3/flatcontainer/phoenixet.edx.utilities/index.json is called it returns a 404 error with a web page stating

Package phoenixet.edx not found

The package can be seen and is queryable via https://xxx.xxx.com/httpAuth/app/nuget/feed/_Root/default/v3/query.

This is occurring for some but not all of our packages.

I've reset the buildsMetaData from the Diagnostics page but it has not fixed the issue.

3
8 comments

The same situation.

If the url of v2 is taken, that works in my case.

1

Hi Cthatcher, 

Had you seen the problem before you updated to the 2021.1 version? 

0

Nadia Burnasheva We had just started migrating our projects to the PackageReference type for NuGet after updating to 2021.1.  So I cannot tell you if this is was a pre-existing issue.

0

Lehin Thank you for the tip! That has me moving forward for now, I greatly appreciate it.

0

Cthatcher, Lehin, I've created the issue for this problem in the YouTrack. Please, watch it to get further updates.

May I ask you to attach teamcity-nuget.log to the issue? 

0

It's even better to enable the "teamcity-nuget" logging preset, reproduce the problem and attach the teamcity-nuget.log to the issue. In this case, we should understand what the cause of the problem is. 

0

We are seeing this exact same issue and it started happening exactly when we migrated to ver 2021.1.  Is there a fix for this?  Our builds are currently breaking.  Going to look into using v2 instead of v3 to see if we can hobble along...but already went down the road of clearing the buildMetadata cache.  nuget log after resetting the cache doesn't show anything other than the fact that it is adding the description of the package entries to the feed.  I can bring the feed up in the VisualStudio package manager UI and all the packages and their versions show, however, we cannot fetch their actual file when we want to install them.  Same goes for trying to do this using "Install-Package" from the package manager console.  Getting "Unable to find package" via the console.

0

We are seeing the exact same issue after updating to 2021.1. The v2 workaround kind of works for now, but it's far from optimal.

0

Please sign in to leave a comment.