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 am getting an error when trying to enable package restore in a new solution I just created. The error in VS2012 is:

NuGet Package Manager

An error occurred while configuring the solution to restore NuGet packages on build

Unable to read package from path 'NuGet.Build.2.7.0.npkg'.

I tried opening the solution in VS2010 to work around the problem and I am also getting an error when trying to enable package restore, but the message is different:

NuGet Package Manager

An error occurred while configuring the solution to restore NuGet packages on build

Archive file cannot be size 0.

I tried creating a new solution, but got the same result.

I then tried doing a repair on VS2012 update 3 and rebooting. Still getting the problem.

I also scanned the folder, project, and solution file for anything NuGet or .nupkg, but there is nothing there.

So how can I get this feature working again? The last time I used it was about a week ago, and I don't remember specifically what I changed since then. I uninstalled the VS Power Tools package that I installed about a week ago, but that didn't fix the problem either.

Update

I followed the "removal" instructions here and used a project I already have as a template to enable package restore manually. However, I am still looking for a better solution because this is a feature I use frequently.

I also tried uninstalling and reinstalling NuGet from visual studio, but I still get the same issue. If memory serves correctly, there was a recent NuGet update (is there a log for VS extension installation so I can check?).

share|improve this question
    
You can enable logging in VS by running devenv.exe /log then look for customactivity.xml – Mike Cheel Sep 9 '13 at 20:32
    
Yea, but that wouldn't do much good for something that happened a week ago... I am looking for something similar to the way Windows Update has an install log of updates. – NightOwl888 Sep 9 '13 at 21:20
    
If you can reproduce I found this: stackoverflow.com/questions/10356981/… – Mike Cheel Sep 10 '13 at 1:26
    
Thanks, but again not what I need. I am not troubleshooting the installation of a NuGet package, but was trying to find a historical list of VSIX package updates I did to Visual Studio that could be interfering with this feature. – NightOwl888 Sep 10 '13 at 10:12
    
Sorry didn't understand what you wanted. – Mike Cheel Sep 10 '13 at 13:14

2 Answers 2

up vote 17 down vote accepted
+50

I suspect that the NuGet.Build.2.7.0.npkg file is zero bytes due to a failed download. NuGet.Build.2.7.0.npkg is the NuGet package that Visual Studio downloads in order to enable package restore for your solution.

Take a look in your cache and see if this file is zero bytes. If so then delete the file or clearing the cache and try enabling package restore again. The cache is under your profile in a directory similar to:

C:\Users\YourUsername\AppData\Local\NuGet\Cache

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

share|improve this answer
1  
Your solution worked great. The error message would have been much more helpful if it gave the full path to the file it was looking for because I had no idea where to look. – NightOwl888 Sep 13 '13 at 8:31

All of the previous answers, plus this one: can you run .\nuget\nuget.exe update -self if this is a solution in which package restore was previously enabled?

share|improve this answer
    
Nope, this problem happens on every new solution I create. I already tried updating NuGet previously. – NightOwl888 Sep 13 '13 at 8:28

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.