Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 941
Brandon Linton Avatar asked Dec 28 '25 15:12

Brandon Linton


1 Answers

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

like image 125
Daniel Persson Avatar answered Dec 31 '25 18:12

Daniel Persson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!