Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I right click on my solution file in my VS2010 and clicked Enable NuGet Package Restore, and I got an error message saying Unable to read package from path 'NuGet.CommandLine.2.7.1.nupkg'.

I googled around and don't see anything close.

Any clue?

share|improve this question

1 Answer 1

The error message is usually because NuGet cannot open the NuGet package because it failed to download it. I would check your NuGet cache to see if the NuGet.CommandLine.2.7.1.nupkg file is zero bytes or smaller than expected. If so delete the file or clear the cache and try again. Sometimes the download can fail and NuGet leaves an empty file in the cache which causes problems on installing that NuGet package. You can also see the error if the NuGet package did not fully download, so the package will not be zero bytes but will not have fully downloaded and NuGet cannot open it. So it is worth deleting the NuGet package from the cache and retrying.

The NuGet cache is in the following directory:

%localappdata%\NuGet\Cache

You can also browse to the NuGet cache from inside Visual Studio by opening the Package Manager Settings, selecting General and clicking the Browse button.

Note that with newer versions of NuGet 2.8 this problem should be fixed. NuGet in later versions will download to a temporary file location and renamed once the download is completed so a partially download NuGet package will not be left in the cache.

share|improve this answer
    
I have just checked my NuGet.CommandLine.2.7.1.nupkg has 416KB size. – hardywang Oct 28 '13 at 12:58
1  
NuGet.CommandLine.2.7.1.nupkg is 446KB. I suspect the package did not download properly. I would delete it and try again. To test the package you can change the file extension to .zip and see if you can open it. – Matt Ward Nov 3 '13 at 18:37
    
Thanks, delete and try again worked for me. – hardywang Nov 5 '13 at 15:34
    
Purging cache worked for as well!!! Please mark this as correct! – Dmitry Nov 5 '13 at 22:55
    
You know, I should say thanks a ton. I was stuck in this issue for quite some time – Shanadas Oct 15 at 9:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.