NuGet packages get stale? “Failed to download package correctly. The contents of the package could not be verified”

StackOverflow https://stackoverflow.com/questions/8139503

Question

We're experiencing a strange issue with our local NuGet package server. Over time, it appears that packages become unavailable, and the only fix seems to be touching the .nupkg file (e.g., just opening the file in Package Explorer) or just create a new build / version of the package.

Here's a picture of the error that comes back:

Failed to verify package contents

We're using IIS6 to host the NuGet server, using the latest NuGet packages for the server (server and core version 1.5.20902.9026)

Does anyone know what's going on and how to fix it for good?

Was it helpful?

Solution

This is actually a bug in NuGet.Server. There's a race condition that causes the feed to get a stale hashcode. You can follow the various discussions about it on nuget.

OTHER TIPS

We came across this on our Jenkins build server all of a sudden, Entity Framework could not be downloaded by NuGet. In our case the problem was that the NuGet.exe that was checked in along with the project itself hadn't been updated in quite some time.

I solved this the following way:

  • Checked out the project from version control
  • Opened a command prompt and navigated to the .nuget subfolder in the project
  • Ran the following command to let NuGet.exe update itself: NuGet.exe update -self
  • In our case this resulted in v1.6 getting updated to v2.7.3 so we have been sloppy :)
  • Checked in the replaced NuGet.exe in version control

After that the project built just fine again. I think we will investigate the possibility to not check in NuGet.exe in the future, this SO post seems to be helpful but I haven't been able to try it myself yet : Prevent needing to add NuGet.exe to source control

I had this problem when I was trying to install T4Scaffolding, and I was able to solve it by re-installing NuGet Package Manager (as I wasn't able update the package manager, I uninstalled, and re-installed).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top