If you're trying to install or manage NuGet packages in Visual Studio and you're getting error messages like "... end of Central Directory" or "Unable to read beyond the end of the stream," then you might have a corrupted .nupkg file.
To solve this, you will have to first see which packages are affected, and then manually download the .nupkg file for each package in question and replace them in your /packages directory.
To check which packages are corrupt, first open Visual Studio and the NuGet Package Manager in Tools > NuGet Package Manager > Manage NuGet Packages for Solutions.
Once you open it, click on the "Installed" tab and that is generally where you'll see the error messages.
To check which packages have corrupted files, open the /packages/packages.config file and one by one, comment out all but one of the <package> elements in <packages>, each time clicking back to the NuGet - Solution tab in VS to see if the error is still happening. If you don't get an error message for one, that means it's fine.
For the packages with errors, you will have to download the .nupkg files manually. Go to the NuGet site and type in the name of the package you want to download. Click "Download" in the left sidebar, making SURE that you have the same version that is in your Visual Studio! Then paste the file and overwrite your current corrupted .nupkg file in /packages/packagename.
Once you do this for each of the corrupted packages, uncomment everything in packages.config and check in the Installed tab again. Hopefully your error messages will be all gone and you'll just have a list of the installed packages.
No comments:
Post a Comment