本文介绍了的NuGet 2.8.6导致依赖于.NET 4.5+?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近开始得到采用最新nuget.exe上构建的机器错误(2.8.6)

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'.

相同的指令/源代码树恢复使用nuget.exe 2.8.5完美

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

构建机上的Windows 2008 R2,.NET 4.0(不4.5允许在此生成的图像更新)和VS 2010年。基本上,我们有一个数字,被配置为特定的组合构建的机器(在Windows,.NET,Visual Studio的)。

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).

这感觉就像是2.8.6版本了对.NET 4.5,打破上机,而它的依赖。

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

推荐答案

我提出这是一个问题,但,从我被告知,有没有计划来解决它: https://github.com/NuGet/Home/issues/1611

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

解决方法是使用NuGet.CommandLine 2.8.5包,它可以在nuget.org找到:

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

  1. 首先下载使用命令<$ C $ 中的包C>安装-包NuGet.CommandLine -Version 2.8.5 中的包管理器控制台
  2. 然后得到可执行从包的安装文件夹( nuget.exe ),并用它来代替的NuGet 2.8.6可执行文件,您正在使用(即在 .nuget \ 文件夹)。
  3. 您可能还需要检查在新的可执行文件到源代码控制。
  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.

这篇关于的NuGet 2.8.6导致依赖于.NET 4.5+?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:04