Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet 2.8.6 causing dependency on .NET 4.5+?

Recently started getting errors on build machines using latest nuget.exe (2.8.6)

.nuget\nuget restore MySolution.sln

Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Exact same command / source tree restores perfectly using nuget.exe 2.8.5

Build machine is Windows 2008 R2, .NET 4.0 (no 4.5 updates allowed on this build image) and VS 2010. Basically, we have a number of build machines that are configured for specific combinations (Windows, .NET, Visual Studio).

It feels like the 2.8.6 build took a dependency on .NET 4.5 that breaks on machines without it.

like image 557
John Watson Avatar asked Oct 19 '22 06:10

John Watson


1 Answers

I raised this as an issue but, from what I have been told, there are no plans to fix it: https://github.com/NuGet/Home/issues/1611

The workaround is to use the NuGet.CommandLine 2.8.5 package which can be found on nuget.org:

  1. First download the package by using the command Install-Package NuGet.CommandLine -Version 2.8.5 in the Package Manager Console.
  2. Then get the executable (nuget.exe) from the package's installation folder and use it to replace the NuGet 2.8.6 executable that you are currently using (i.e. in the .nuget\ folder).
  3. You may want to also check in the new executable into source control.
like image 187
Philip Atz Avatar answered Nov 15 '22 05:11

Philip Atz