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

查看:152
本文介绍了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)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.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)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.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 restore命令时,我们会看到以下内容:MSBuild自动检测:使用来自'C:\ Program Files(x86)\ MSBuild \ 14.0 \ bin'的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)\MSBuild\14.0\bin'.

但是在所有错误开始的日志中,我们会看到以下内容(注意:错误的工具版本): C:\ Program Files(x86)\ MSBuild \ 12.0 \ bin \ MSBuild.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)\MSBuild\12.0\bin\MSBuild.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:

HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\12.0\MSBuildOverrideTasksPath
HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0\MSBuildToolsPath

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

In both cases, I changed the value

来自:

C:\Program Files (x86)\MSBuild\12.0\bin\

收件人:

C:\Program Files (x86)\MSBuild\14.0\bin\

免责声明:我不知道这还会有什么其他影响,但是它使用正确的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天全站免登陆