3
votes

I have a Visual Studio 2015 C# project consuming packages from NuGet. The solution contains several C# projects and is checked out on drive C.

Problem: I cannot compile the solution or restore nuget packages since several hours. I get the following error:

NuGet Package restore failed for project ...: The file or directory is corrupted and unreadable.

The Package Manager Console reports the following error after startup:

The file or directory is corrupted and unreadable.

Restarting Visual Studio does not fix the issue. Accessing the files with File Explorer and Notepad++ works. I don't experience any internet connectivity issues. Nuget seems to be online.

There is no private nuget registry in use, the default package source https://api.nuget.org/v3/index.json is used.

Visual Studio 2015 Professional 14.0.25431.01 Update 3 Package Manager Console Host Version 3.6.0.2511

2

2 Answers

2
votes

VS 2015: C# NuGet Package restore failed. The file or directory is corrupted and unreadable

Please try the following troubleshootings to fix this issue:

  • Remove all nuget packages under \packages folder, then go to the solution in Visual Studio and press "Restore Nuget Packages", rebuild your solution.
  • Go to Tools->Extensions and Updates->Installed, uninstall the NuGet Package Manager for Visual Studio 2015, and reinstall it.

Hope this helps.

0
votes

It may be the file system error in the drive

I use system drive tool to check and fix the error windows file system error check tool