Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
862 views
in Technique[技术] by (71.8m points)

c# - TFSBuild 2013 unable to change msbuild version

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.

Symptoms:

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

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.

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

  • Installing 2015 build tools (update 3) on the build server
  • Installing VS2015 on the build server (Yuck)
  • Various combinations of MSBuild parameters in the build definition. (/tv:14.0 & /p:VisualStudioVersion=14.0)
  • Inclusion of Microsoft.Net.Compilers nuget package
  • Editing the TfvcTemplate.12.xaml template and setting "Run MSBuild" step to set "ToolsVersion" to "14.0". (Note, there is no "ToolsPath" setting in this version of the template, so I cant do that).
  • Setting ToolsVersion="14.0" in every .csproj file

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

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

from:

C:Program Files (x86)MSBuild12.0in

to:

C:Program Files (x86)MSBuild14.0in

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...