TFS Build 2015 由于 NuGet 版本不正确而失败,即使构建机器中存在所需的版本 [英] TFS Build 2015 failing because of incorrect NuGet version even when the required one is present in the build machine

查看:51
本文介绍了TFS Build 2015 由于 NuGet 版本不正确而失败,即使构建机器中存在所需的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用新的可脚本化系统配置 TFS 2015 版本.在构建过程中,当 NuGet 正在还原某些包时,它失败并显示以下错误:

I'm configuring a TFS 2015 build using the new scriptable system. During the build, when NuGet is retoring some packages, it fails with the following error:

'System.Collections 4.0.10' 包需要 NuGet 客户端版本'3.0' 或更高版本,但当前 NuGet 版本为 '2.8.60318.667'.

The 'System.Collections 4.0.10' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.

System.Diagnostics.Debug 4.0.10"包需要 NuGet 客户端版本 '3.0' 或更高版本,但当前的 NuGet 版本是'2.8.60318.667'.

The 'System.Diagnostics.Debug 4.0.10' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.

System.Globalization 4.0.10"包需要 NuGet 客户端版本 '3.0' 或更高版本,但当前的 NuGet 版本是'2.8.60318.667'.

The 'System.Globalization 4.0.10' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.

System.Linq 4.0.0"包需要 NuGet 客户端版本3.0"或上面,但当前的 NuGet 版本是2.8.60318.667".

The 'System.Linq 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.

System.Resources.ResourceManager 4.0.0"包需要 NuGet客户端版本3.0"或更高版本,但当前的 NuGet 版本是'2.8.60318.667'.

The 'System.Resources.ResourceManager 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.

'System.Runtime 4.0.20' 包需要 NuGet 客户端版本'3.0' 或更高版本,但当前 NuGet 版本为 '2.8.60318.667'.

The 'System.Runtime 4.0.20' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.

System.Runtime.Extensions 4.0.10"包需要 NuGet 客户端版本 '3.0' 或更高版本,但当前的 NuGet 版本是'2.8.60318.667'.

The 'System.Runtime.Extensions 4.0.10' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.

System.Threading 4.0.10"包需要 NuGet 客户端版本'3.0' 或更高版本,但当前 NuGet 版本为 '2.8.60318.667'.

The 'System.Threading 4.0.10' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60318.667'.

顺便说一句,我已经在整个构建机器中安装了 Visual Studio 2015,并且我已经检查了 NuGet 3.1 是否存在于扩展管理器菜单中.

BTW, I've installed Visual Studio 2015 in the whole build machine and I've checked that NuGet 3.1 is present in the extensions manager menu.

我猜 TFS Build 使用的是不同的 NuGet 安装位置,但我不知道在哪里寻找它以及如何将它从 2.8.x 更新到 3.x.

I guess TFS Build is using a different NuGet installation location, but I can't figure out where's looking for it and how do I update it from 2.8.x to 3.x.

推荐答案

此问题有一个解决方法.

There's a workaround to this problem.

默认情况下,如果您使用 VSBuild/MSBuild 任务,则只能通过相应的复选框选择是否运行 nuget restore.但是有一个名为 NuGet 安装程序 的单独任务(它位于 Package 部分).它为 NuGet.exe 的自定义路径公开了一个可选字段:

By default, if you use VSBuild/MSBuild tasks, you can only choose whether to run nuget restore or not via the appropriate checkbox. But there is a separate task called NuGet Installer (it lives in the Package section). It exposes an optional field for the custom path to the NuGet.exe:

所以,这是一个想法:

  • 在适当的 VSBuild/MSBuild 步骤之前安排 NuGet 安装程序步骤
  • 指定 NuGet.exe 的正确自定义路径
  • 确保 VSBuild/MSBuild 步骤的Restore NuGet 包标志关闭

注意:您的解决方案直接在构建代理内部替换物理可执行文件可能会很好地工作,直到代理更新(有意或以某种方式自动)并用更新但仍然过时的版本覆盖 NuGet.exe.

NOTE: Your solution with replacing the physical executable directly in the build agent internals might work well up until the agent is updated (either on purpose, or somehow automatically) and overwrites NuGet.exe with newer, but still outdated version.

这篇关于TFS Build 2015 由于 NuGet 版本不正确而失败,即使构建机器中存在所需的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆