0
votes

When building my solution, I randomly receive one of these errors:

C:\working_directory.nuget\NuGet.targets(91, 5): Type handle 'NuGet.ProjectModel.LockFile' and method handle with declaring type 'NuGet.ProjectModel.HashCodeCombiner' are incompatible. Get RuntimeMethodHandle and declaring RuntimeTypeHandle off the same MethodBase. C:\working_directory.nuget\NuGet.targets(91, 5): error MSB3073: The command ""C:\working_directory.nuget\NuGet.exe" install "C:\working_directory\Project_A\packages.config" -source "https://www.nuget.org/api/v2/" -NonInteractive -RequireConsent -solutionDir "C:\working_directory\ "" exited with code 1.

C:\working_directory.nuget\NuGet.targets(91, 5): Common Language Runtime detected an invalid program. C:\working_directory.nuget\NuGet.targets(91, 5): error MSB3073: The command ""C:\working_directory.nuget\NuGet.exe" install "C:\working_directory\Project_B\packages.config" -source "https://www.nuget.org/api/v2/" -NonInteractive -RequireConsent -solutionDir "C:\working_directory\ "" exited with code 1. An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

C:\working_directory.nuget\NuGet.targets(91, 5): The signature is incorrect. C:\working_directory.nuget\NuGet.targets(91, 5): error MSB3073: The command ""C:\working_directory.nuget\NuGet.exe" install "C:\working_directory\Project_C\packages.config" -source "https://www.nuget.org/api/v2/" -NonInteractive -RequireConsent -solutionDir "C:\working_directory\ "" exited with code 1.

C:\working_directory.nuget\NuGet.targets(91, 5): Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'NuGet, Version=3.5.0.1938, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Index not found. (Exception from HRESULT: 0x80131124) --- System.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124) C:\working_directory.nuget\NuGet.targets(91, 5): --- End of inner exception stack trace --- C:\working_directory.nuget\NuGet.targets(91, 5): error MSB3073: The command ""C:\working_directory.nuget\NuGet.exe" install "C:\working_directory\Project_A\packages.config" -source "https://www.nuget.org/api/v2/" -NonInteractive -RequireConsent -solutionDir "C:\working_directory\ "" exited with code 255.

C:\working_directory.nuget\NuGet.targets(91, 5): Abstract method with non-zero RVA. C:\working_directory.nuget\NuGet.targets(91, 5): error MSB3073: The command ""C:\working_directory.nuget\NuGet.exe" install "C:\working_directory\Project_D\packages.config" -source "https://www.nuget.org/api/v2/" -NonInteractive -RequireConsent -solutionDir "C:\working_directory\ "" exited with code 1.

This used to happen only on one machine, now another machine is seeing the same problem.

This issue is not persistent , I can successfully build my solution after rebuilding for a few times. I've also tried "Clean Solution" but it does not fix the issue.

I'm not sure what's wrong since the errors are random and not persistent :(

Can someone shed some light? I am using VS2015, another machine using VS2013 also experience the same issue now.

1
Which Nuget.exe version do you use?CodeTherapist
@CSharper Looks like I'm using 3.5.0.1938, let me try the latest recommended v4.4.1Dhinnesh Jeevan
BadImageFormatException can happen if you try and load a 64 bit DLL into a 32 bit process.John Koerner
I was seeing this issue every so often with version 3.5.0.1938. I upgraded to the latest (5.1.0.6013) and I have not seen the problem since.srk

1 Answers

0
votes

I have just run into this. In my case, it was a disk space issue. Check the free space on your C:\ ???