locked
How to get VS 2017 working with TFS 2017 XAML Builds RRS feed

  • Question

  • The problem:

    Old Visual Studio versions installed msbuild into C:\Program Files (x86)\MSBuild\<version>\bin and apparently the RunMSBuild activity used the ToolVersion + the ToolArchitecture to calculate this path.

    VS 2017 instead installs it C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin and the RunMSBuild can't calculate the proper path anymore and this path is even user selectable now.

    The idea to set ToolPath does not work as RunMSBuild has no ToolPath property.

    My current workaround is to add the new MS Build 15 path to %PATH% of the builduser and use the "pathless" msbuild discovery.

    But I can't imagine that's the right way to go.

    Wednesday, March 8, 2017 2:18 PM

All replies

  • There si no supported way really, XAML builds are deprecated and support for Visual Studio hasn't been built in. The supported way forward is tp really use new build agent infrastructure.

    That said, using the /tv:15 msbuild switch should still work if it's configured to look at a decently recent version of Msbuild.exe


    My blog: blog.jessehouwing.nl

    Wednesday, March 8, 2017 6:49 PM
  • The proposed solution does not work, even on a server with TFS 2017 Update 1 and VS 2017 installed, instead gives the error below:

    MSBUILD : error MSB1040: ToolsVersion is not valid. The tools version "15.0" is unrecognized. Available tools versions are "12.0", "14.0", "2.0", "3.5", "4.0".
    Switch: 15.0
    Tuesday, March 28, 2017 11:05 PM
  • Hi,

    Thank you for posting here,

    Xaml builds working with TFS2017 is proving challenging, as mentioned by Jesse in above post, XAML builds are deprecated and support for Visual Studio, it hasn't been built in.

    Please see this article for more info: https://www.finalbuilder.com/resources/blogs/postid/749/visual-studio-2017-rc-support

    Best Regards.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 30, 2017 12:44 PM
  • There is an undocumented change you can make to the TFSBuildServiceHost.exe.config that will cause the MSBuild tasks to use a specific MsBuild Location. You must have a version of VS 2013 or VS 2015 installed on the build server in order for this to work. The BuildTools flavor will do. This does nothing to fix the unit testing tasks, they will still bomb out. But at least you can compile.

    <configuration>
       <configSections>
        <!-- VS2013 -->
         <!-- <section name="msbuildToolsets" type="Microsoft.Build.Evaluation.ToolsetConfigurationSection, Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" requirePermission="false" /> -->
        <!-- VS2015 -->
        <section name="msbuildToolsets" type="Microsoft.Build.Evaluation.ToolsetConfigurationSection, Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" requirePermission="false" />
      </configSections>
    ... snip ...
      <msbuildToolsets>
          <toolset toolsVersion="15.0">
             <property name="MSBuildToolsPath" value="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin" />
          </toolset>
          <toolset toolsVersion="latest">
             <property name="MSBuildToolsPath" value="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin" />
          </toolset>      
       </msbuildToolsets>
    </configuration>
    

    The toolsVersion referenced here is NOT the tools version on the MSBuild command line (/tv) its the ToolsVersion property passed to the MSBuild and RunMSBuild tasks inside of the Xaml build template. The "latest" version is what is used if this property is empty.  I have found that you will still need to supply the MSBuild Command Line parameters:

    /tv:15.0 /p:VisualStudioVersion=15.0

    to get VS2017 projects to compile.  You may also need to change the VS2017 MSBuild path as well depending on which flavor you have installed. What I have above assumes Enterprise edition.

    Edit the config file and restart the "Visual Studio Team Foundation Build Service Host" service.

    Once again this is completely undocumented, does nothing to fix unit testing, and I am pretty sure unsupported.

    • Proposed as answer by Shaun_Bowe Thursday, April 20, 2017 10:01 PM
    Friday, April 14, 2017 2:07 PM
  • Jonesy2488, this worked perfectly for my setup: TFS 2013, xaml build template, with Visual Studio 2017 build tools installed.

    At some point we'll do the build server upgrade.

    Thank you!

    Thursday, July 20, 2017 12:14 AM