Monday, February 3, 2014

NuGet install fails: "Unable to read package from path '[snip].nupkg'"

In my case, this issue came almost out of nowhere. The package installation/restoration succeeded using a regular Windows account, but failed under the SYSTEM account. You've probably verified permissions and what not, so I'll get to the solution to my specific problem: The NuGet cache was corrupted.

To verify that this is the case for you, delete the "packages" folder in your solution folder, then attempt to restore/install packages again, but add the "-NoCache" argument to your command line to prevent NuGet from using the local cache. See NuGet command line reference.

Once you verify that the cache is the problem, locate the cache folder, then simply delete the folder.

Restore/Install packages once more to verify success!

NuGet cache locations

Regular user accounts

%LOCALAPPDATA%\NuGet\Cache (C:\Users\<user>\AppData\Local\NuGet\Cache)

SYSTEM account