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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…