locked
How to tell MSBuild on TFS 2015 build server to build using VS 2017 instead of VS 2015? RRS feed

  • Question

  • Hello everybody,

    I just uninstalled VS 2015 and then installed VS 2017 Enterprise on our TFS 2015.3 build machine (running Windows 10). I altered ToolVersion="14.0" with ToolVersion="15.0" in the build definition process file. However, builds fail, for example with "nameof is not defined". The logs tell me that the compilers are started from the .net framework 4.0 x64 directories, but not from the VS (roslyn) directories.

    How can I get the build server to build using VS 2017 please?


    Best Regards, Stefan Falk



    • Edited by Stefan Falk Wednesday, March 8, 2017 8:20 PM typo
    Wednesday, March 8, 2017 8:19 PM

Answers

  • Hello everybody,

    as I have restored the build machine back to the working state with VS2015, my problem is no longer urgent. I'll give vNext builds a try as soon as I have time to do so. I agree that questions about that should go into another thread, if there will arise any.

    Thank you all for your anwers.


    Best Regards, Stefan Falk

    • Marked as answer by Stefan Falk Monday, March 13, 2017 10:40 AM
    Monday, March 13, 2017 10:40 AM

All replies

  • Hi Stefan,

    Thank you for posting here.

    According to your description it should be XAML build. XAML builds are deprecated and support for VS2017 hasn't been built in.

    Anyway, please try to add additional MSBuild arguments in XAML build template Advanced settings (Please refer to below screenshot).

    Add the following MSBuild arguments: "/tv:15.0 /p:VisualStudioVersion=15.0"

    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 9, 2017 10:09 AM
  • Hello whoever answered ;-)

    Thank you very much for your response. I tried your suggestion, but did no have success yet. The details:

    In the XAML build definition (you correctly suspected XAML), the "VS 2015" version was [1]:

    <mtba:RunMSBuild DisplayName="Run MSBuild" OutputLocation="[OutputLocation]" CleanBuild="[CleanBuild]" CommandLineArguments="[String.Format(&quot;/p:SkipInvalidConfigurations=true,GenerateBuildInfoConfigFile=false {0}&quot;, AdvancedBuildSettings.GetValue(Of String)(&quot;MSBuildArguments&quot;, String.Empty))]" ConfigurationsToBuild="[ConfigurationsToBuild]" ProjectsToBuild="[ProjectsToBuild]" ToolPlatform="[AdvancedBuildSettings.GetValue(Of String)(&quot;MSBuildPlatform&quot;, &quot;Auto&quot;)]" ToolVersion="14.0" RunCodeAnalysis="[AdvancedBuildSettings.GetValue(Of String)(&quot;RunCodeAnalysis&quot;, &quot;AsConfigured&quot;)]" />
    

    The current line is as follows [2]:

    <mtba:RunMSBuild CleanBuild="[CleanBuild]" CommandLineArguments="[String.Format(&quot;/p:SkipInvalidConfigurations=true,GenerateBuildInfoConfigFile=false,VisualStudioVersion=15.0 {0}&quot;, AdvancedBuildSettings.GetValue(Of String)(&quot;MSBuildArguments&quot;, String.Empty))]" ConfigurationsToBuild="[ConfigurationsToBuild]" DisplayName="Run MSBuild" Enabled="True" sap2010:WorkflowViewState.IdRef="RunMSBuild_1" MSBuildMultiProc="True" OutputLocation="[OutputLocation]" ProjectsToBuild="[ProjectsToBuild]" RestoreNuGetPackages="True" RunCodeAnalysis="[AdvancedBuildSettings.GetValue(Of String)(&quot;RunCodeAnalysis&quot;, &quot;AsConfigured&quot;)]" ToolPlatform="[AdvancedBuildSettings.GetValue(Of String)(&quot;MSBuildPlatform&quot;, &quot;Auto&quot;)]" ToolVersion="4.0" Verbosity="Normal" />

    So, the current command line options for MSBuild are computed as [3]:

    String.Format("/p:SkipInvalidConfigurations=true,GenerateBuildInfoConfigFile=false,VisualStudioVersion=15.0 {0}", AdvancedBuildSettings.GetValue(Of String)("MSBuildArguments", String.Empty))

    I ommitted /tv:15, as when I tried with the following definition [4]:

    String.Format("/p:SkipInvalidConfigurations=true,GenerateBuildInfoConfigFile=false,VisualStudioVersion=15.0 /tv:15.0 {0}", AdvancedBuildSettings.GetValue(Of String)("MSBuildArguments", String.Empty))

    I only got the following error message (german, meaning that /tf accepts only 2.0, 3.5 or 4.0):

    MSBUILD : error MSB1040: ToolsVersion ist nicht gültig. Unbekannte Toolsversion 15.0. Verfügbare Toolsversionen sind "2.0", "3.5", "4.0". Schalter: 15.0

    However, with the value set as in [2] (and thus the parameters computed as in [3]), the build log still shows that the wrong (imho) compiler is choosen. MSBuild calls

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Vbc.exe

    I guess this is the problem, or am I wrong?

    I still seem to have something wrong and am thankful for any tip.

    As to the deprecation of XAML builds, I would appreciate answers to the following questions in addition:

    a) TFS 2017 still does support running XAML builds, as long as it is a separate build machine, doesn't it?

    b) I know I will have to switch to the TFS 2015 build system in some time. However, I have 96 (!) build definitions here (two for each of my products), unifiedly created by a PowerShell script. I am willing to switch to Build vNext, but is there a reference about how to create (and, if needed, alter) all the build definitions at once, using PowerShell or whatever?

    c) Would it be a good idea to inplace-upgrade TFS 2015.3 to TFS 2017 in my situation? And then upgrade the 2015 build machine to 2017, or leave it at 2015 until I can switch to Build vNext?

    Thank you very much for your enlightment!


    Best Regards, Stefan Falk


    • Edited by Stefan Falk Thursday, March 9, 2017 1:27 PM typo
    Thursday, March 9, 2017 1:26 PM
  • Hi Stefan,

    Thank you for posting here.

    You can try to set environment variables MSBuild15Path (for MSBuild) .

    a) xaml builds working with TFS2017 is proving challenging, 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

    b) It's totally different technology. I don't think there will be any automated ways of converting.

    The new builds are based on a different architecture and run on a completely different system, here are some pointers from Microsoft, which may help you.

    c) Suggest you update to TFS 2017 and keep the build machine as 2015 if you have many Xaml build definitions.

    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.


    Friday, March 10, 2017 11:13 AM
  • Hello again,

    Thank you for your posting. I have set system-wide environment variables

    VisualStudio2017Path = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE

    MSBuild15Path = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin

    and rebooted the build machine. The compiler error messages are the same (nameof is not defined).

    As I understand, FinalBuilder is a totally separate product anyway, isn't it? Would TFS build look at these variables at all?

    As to question b), I did not intend to convert my XAML builds to vNext, but thought of creating a new PowerShell script which will create all new vNext builds. So, the questions targets if there is any documentation about creating new vNext build definitions via scripting, not converting XAML to vNext. Is there anything about creating vNext builds automatically out there?

    As work needs to continue here, I indent to restore the build VM from backup (I did take one before the move to VS 2017), and then to experiment with VS 2017 in addition to VS 2015 (without uninstalling 2015). This should give me more time to convert to vNext builds. Perhaps, I try updating to TFS 2017 on the TFS box - we'll see ;-)


    Best Regards, Stefan Falk


    • Edited by Stefan Falk Saturday, March 11, 2017 12:08 PM typo
    Friday, March 10, 2017 12:07 PM
  • Hi Stefan,

    Thank you for posting here,

    have you checked the settings in project level? here is an article for you reference.

    In addition, please try to check if you can build the project successfully from command line, also check if the v-Next build works with MSBuild 15.0.

    As mentioned in previous post, XAML builds are deprecated, not sure how to build in in feature.So, you can try the v-next build anyway.

    I suggest you submit new posts for other questions as we can track them effectively, also can be beneficial to other community members reading this thread. 

    Anyway as different tasks set for each v-next build definition, I think there isn't a effective way to batch create via scripting, if there are same tasks and paths we can clone and fix a bit for them.

    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.


    Monday, March 13, 2017 10:35 AM
  • Hello everybody,

    as I have restored the build machine back to the working state with VS2015, my problem is no longer urgent. I'll give vNext builds a try as soon as I have time to do so. I agree that questions about that should go into another thread, if there will arise any.

    Thank you all for your anwers.


    Best Regards, Stefan Falk

    • Marked as answer by Stefan Falk Monday, March 13, 2017 10:40 AM
    Monday, March 13, 2017 10:40 AM