"File contains corrupted data" when opening the package manager console

Sep 13, 2011 at 4:12 PM
File contains corrupted data.
We have seen this in the past when trying to download items, and it always turned out we had a local package corrupted. This is one of my favorite errors because it is so helpful in determining which package is corrupted. ;)
I did a quick search and there was a similar bug http://nuget.codeplex.com/workitem/1100, but it is not believed that these are the same. I cleared my local cache and tried again.
This error occurs the minute you open the PM console. If you try to get-package (which is local) you get:
Get-Package : File contains corrupted data.
At line:1 char:12
+ get-package <<<< 
    + CategoryInfo          : NotSpecified: (:) [Get-Package], FileFormatException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.GetPackageCommand
I'm chalking this up to sometimes these things happen. However I would like for NuGet to tell me what file is corrupted if possible to save on troubleshooting time in the future.
Sep 13, 2011 at 5:30 PM

Only a few corrupted local packages. Any thoughts on making this error more robust?

Sep 13, 2011 at 6:08 PM

How did you get those packages in there and why are they corrupted?

Sep 13, 2011 at 7:02 PM

Had the packages there for awhile. Not sure how they went bad, could have been the result of a bad merge. To repro, you can literally zip up a file and name it like an existing nupkg. Drop it in over the top of the good package. Then open vs and enjoy the fun. :)

"Be passionate in all you do"


Oct 21, 2011 at 6:35 PM

I have the same problem rendering nuget non-functional. Do you have any thoughts on how to debug this?

Oct 21, 2011 at 6:48 PM

Try clearing your package cache %LOCALAPPDATA%\NuGet\Cache (you can also clear it in the Package Manager Settings option)

Oct 21, 2011 at 6:54 PM
Edited Oct 21, 2011 at 6:56 PM

I should have mentioned that I tried that.  I think I may have multiple problems.  Apparently we moved some projects around and renamed others.

The repositories.config file pointed to locations which did not exist. Fixing these paths did not fix the problem though.

Is a nuget.config file required per project when using a custom packages path?

More detail in the error message would definitely be a huge help here.

Oct 21, 2011 at 7:11 PM
Install Nuget Package Explorer and open every NuPkg file in your packages folder. You will likely find a corrupted one or two.

I've run into this issue before. Not sure what causes it to happen though. May have something to do with source control, or it may be an external item (like Antivirus) inspecting the files.
"Be passionate in all you do"


Oct 23, 2011 at 10:55 PM

Thanks, this helped me find the corrupt package. Someone upgraded one of our in house nupkgs and for whatever reason it is corrupt.

Sep 6, 2012 at 9:24 AM

I have this problem, but it doesnt seem to have any of the packages on my machine pertaining to the solution so I cant check them using Nuget Package Explorer

I did manually download the packages but this didn't work, failed to add the references and uninstalled EntityFramework again

Virus Scan is not touching the files

The cache is cleared

Can anyone help?

Jan 27, 2015 at 9:32 AM
i take this error when trying install umbraco cms in visual studio 2010, in VS2013 all install fine