TFSBuild 2013 无法更改 msbuild 版本 [英] TFSBuild 2013 unable to change msbuild version

查看:22
本文介绍了TFSBuild 2013 无法更改 msbuild 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 TFSBuild 2013 服务器,我们现在正尝试用它来构建 UWP 项目,但我们似乎无法让它使用正确的 MSBuild 版本.

I have a TFSBuild 2013 server that we are trying to now build UWP projects with, but we cannot seem to make it use the correct MSBuild version.

症状:

在构建 UWP 项目时,我们会遇到很多这样的错误:C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0AppxPackageMicrosoft.AppXPackage.Targets (283):尝试对10.0.11000.0"进行数值比较,结果为10.0.11000.0"一个数字,条件为'$(TargetPlatformVersion)' >= '10.0.11000.0'".

When building the UWP projects, we get lots of errors like this: C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0AppxPackageMicrosoft.AppXPackage.Targets (283): A numeric comparison was attempted on "10.0.11000.0" that evaluates to "10.0.11000.0" instead of a number, in condition "'$(TargetPlatformVersion)' >= '10.0.11000.0'".

关于此错误的报告比比皆是,所有报告都告诉您要确保 TFS Build 使用正确版本的 MSBuild.这就是问题所在.我们似乎无法让构建服务器使用正确的版本.

Many reports abound for this error, all telling you to ensure that TFS Build is using the correct version of the MSBuild. And herein lies the issue. We cannot seem to make the build server use the correct version.

这是我们尝试过的(构建定义使用 TfvcTemplate.12.xaml 模板):

Here is what we have tried (build definitions are using TfvcTemplate.12.xaml template):

  • 在构建服务器上安装 2015 构建工具(更新 3)
  • 在构建服务器上安装 VS2015 (Yuck)
  • 构建定义中 MSBuild 参数的各种组合.(/tv:14.0 &/p:VisualStudioVersion=14.0)
  • 包含 Microsoft.Net.Compilers nuget 包
  • 编辑 TfvcTemplate.12.xaml 模板并设置运行 MSBuild"步骤以将ToolsVersion"设置为14.0".(请注意,此版本的模板中没有ToolsPath"设置,所以我不能这样做).
  • 在每个 .csproj 文件中设置 ToolsVersion="14.0"

无论我们如何更改,都无法让 Build Agent 使用 14.0 版本的 MSBuild.

No matter what we change, we cannot get the Build Agent to use the 14.0 version of MSBuild.

奇怪的是,nuget 在进行包还原时似乎找到了正确的版本.在运行 nuget.exe 恢复命令时,我们在日志中看到:MSBuild 自动检测:使用来自C:Program Files (x86)MSBuild14.0in"的 msbuild 版本14.0".

Strangely, nuget seems to find the correct version when doing the package restore. In the logs we see this when running the nuget.exe restore command: MSBuild auto-detection: using msbuild version '14.0' from 'C:Program Files (x86)MSBuild14.0in'.

但在日志的更深处,所有错误开始的地方我们看到了这一点(注意:错误的工具版本):C:Program Files (x86)MSBuild12.0inMSBuild.exe/nologo/noconsolelogger "C:Builds..." [SNIP]

But further down in the logs, where all the errors start we see this (note: wrong tools version): C:Program Files (x86)MSBuild12.0inMSBuild.exe /nologo /noconsolelogger "C:Builds..." [SNIP]

感谢收到任何帮助或建议 - 我不知所措:)

Any help or suggestions gratefully received - I'm at my wits end :)

推荐答案

我终于放弃了尝试通过配置使其行为,但通过破解注册表设法使其在构建机器上运行.

I finally gave up trying to make this behave with configuration, but managed to get this working on the build machine by hacking the registry.

我更改了以下注册表项:

I changed the following registry keys:

HKLMSOFTWAREWow6432NodeMicrosoftMSBuild12.0MSBuildOverrideTasksPath
HKLMSOFTWAREWow6432NodeMicrosoftMSBuildToolsVersions12.0MSBuildToolsPath

在这两种情况下,我都更改了值

In both cases, I changed the value

来自:

C:Program Files (x86)MSBuild12.0in

到:

C:Program Files (x86)MSBuild14.0in

免责声明:我不知道这会产生什么其他影响,但它使用正确的 MSBuild 版本获得了我们的构建,并且范围仅限于构建服务器.

Disclaimer: I don't know what other affects this will have, but its got our builds using the correct MSBuild version, and is limited in scope to the build server.

这篇关于TFSBuild 2013 无法更改 msbuild 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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