NuGet Package restore exited with code -1

7

I get the following error in the Ouput window:

D:\{solutionPath}\.nuget\nuget.targets(76,9): error : 
D:\{solutionPath}\.nuget\nuget.targets(76,9): error : Unhandled Exception: OutOfMemoryException.
D:\{solutionPath}\.nuget\nuget.targets(76,9): error MSB3073: The command ""D:\{solutionPath}\.nuget\nuget.exe" install "D:\{pathToConfigLocation}\packages.config" -source "" -o "D:\{solutionPath}\packages"" exited with code -1.

The above is with the NuGet.targets as it comes.

D:\{solutionPath}\.nuget\nuget.targets(76,9): error : 
D:\{solutionPath}\.nuget\nuget.targets(76,9): error : Unhandled Exception: OutOfMemoryException.
D:\{solutionPath}\.nuget\nuget.targets(76,9): error MSB3073: The command ""D:\{solutionPath}\.nuget\nuget.exe" install "D:\{pathToConfigLocation}\packages.config" -source "{localPackageDir}" -o "D:\{solutionPath}\packages"" exited with code -1.

Is with my package source in the NuGet.targets

When the build is taking place it creates as many nuget.exe processes as it takes for it to use up all the memory, then it fails and has another go at it.

I have taken the command and run it via cmd.

"D:\{longPah}\.nuget\nuget.exe" install "D:\{longPah}\packages.config" -source "\\{longPah}\NuGetPackages" -o "D:\{longPah}\packages"

This gives me the following error:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembl
y 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or
 one of its dependencies. Exception from HRESULT: 0x800705AF
   at Bootstrapper.Program.Main(String[] args)

I have .net 4 on the machine.

Please help if you can.

Thanks, David

EDIT

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Company.Common.Library" version="0.1.2" targetFramework="net35" />
</packages>

packages.config as requested.

EDIT

I have tried running the command via Visual studio command prompt (running as administrator) and it throws the following exception:

Unhandled Exception: OutOfMemoryException.

EDIT - POSSIBLE FIX

I think I have found the problem... its seems to be to do with the nuget.exe thats inside the .nuget folder.

I have several solutions and found a couple that work, waisted loads of time looking at file perms (was advised that was the issue) then thought to check the nuget.exe properties in each of the solutions.

In the solutions that worked I found:

enter image description here

In the solutions that wouldn't I found:

enter image description here

As you can see, the file size of the two is drastically different. All the projects got added by different people in the team, Could this be an issue with the version of nuget installed on the dev's machines?

If so does anyone know which version of nuget causes the above issue when you select to enable package restore for the solution? I have the latest version of NuGet installed on my machine btw.

visual-studio-2010
nuget
asked on Stack Overflow Jul 3, 2012 by David McLean • edited Jul 5, 2012 by David McLean

1 Answer

13

Both of them will cause the error. The smaller file is just a shell that passes commands to a real version that it downloads to %LOCALAPPDATA%\NuGet. It checks for newer versions every 10 days.

Take a look at this issue: http://nuget.codeplex.com/workitem/2390 (nuget package restore assumes internet access) - could be that the 18K shell is trying to download the full nuget.exe to the %LOCALAPPDATA%\NuGet folder and can't for some reason.

When NuGet 2.0 was released it came with an opt-in consent for Package Restore. Take a look at http://blog.nuget.org/20120619/nuget-2.0-released.html and http://blog.nuget.org/20120518/package-restore-and-consent.html, which details what needs to be done to get it to work.

Alternatively you can permanently accept the entire consent by using the NugetEnablePackageRestore package - http://nuget.org/packages/NuGetEnablePackageRestore - note that this fix will fix it for all future users including build servers.

answered on Stack Overflow Jul 10, 2012 by ferventcoder • edited Jul 10, 2012 by ferventcoder

User contributions licensed under CC BY-SA 3.0