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.
答案 0 :(得分:2)
我提出这是一个问题,但据我所知,没有计划解决它: https://github.com/NuGet/Home/issues/1611
解决方法是使用NuGet.CommandLine 2.8.5软件包,该软件包可以在nuget.org上找到:
Install-Package NuGet.CommandLine -Version 2.8.5
命令下载Package Manager Console。nuget.exe
)并使用它来替换您当前使用的NuGet 2.8.6可执行文件(即在.nuget\
文件夹中) 答案 1 :(得分:1)
如果您使用TeamCity,则可以在不更改源代码的情况下解决此问题。
转到TeamCity→管理→集成→NuGet,然后使用“获取NuGet”按钮获得2.8.5或3.3.0。
如果要将其用于所有项目或设置NuGet还原步骤以使用此特定版本,请将其设为默认值。