How to enable C # 7 build in Team Foundation Server 2015?

We have Team Foundation Server (TFS) 2015 installed on site. We would like to use Visual Studio 2017 to take advantage of the latest features in C #. We are not ready to upgrade to TFS 2017. What are the steps necessary to ensure that you can use the latest C # language features in TFS 2015?

+5
source share
2 answers

I did not follow these steps exactly, but based on what I found out, I think they would work:

  1. Install Visual Studio 2017 build tools on the XAML build configuration server
  2. Add these lines to the TFSBuildServiceHost.exe.config file:
  <configSections>
    <section name="msbuildToolsets" type="Microsoft.Build.Evaluation.ToolsetConfigurationSection, Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" requirePermission="false" />
  </configSections>
  <msbuildToolsets>
    <toolset toolsVersion="15.0">
      <property name="MSBuildToolsPath" value="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin" />
    </toolset>
    <toolset toolsVersion="latest">
      <property name="MSBuildToolsPath" value="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin" />
    </toolset>
  </msbuildToolsets>

C: \ Program Files \ Microsoft Team Foundation Server 14.0 \ Tools \ TFSBuildServiceHost.exe.config

(I would never understand this without posting . Thanks, jonesy2488 !)

  1. Restart the XAML build configuration service.
  2. Modify the XAML build process template by adding the ToolVersion = "15.0" parameter to it:
<mtba:RunMSBuild DisplayName="Run MSBuild" OutputLocation="[OutputLocation]" CleanBuild="[CleanBuild]" CommandLineArguments="[String.Format(&quot;/p:SkipInvalidConfigurations=true {0}&quot;, AdvancedBuildSettings.GetValue(Of String)(&quot;MSBuildArguments&quot;, String.Empty))]" ConfigurationsToBuild="[ConfigurationsToBuild]" ProjectsToBuild="[ProjectsToBuild]" ToolVersion="15.0" ToolPlatform="[AdvancedBuildSettings.GetValue(Of String)(&quot;MSBuildPlatform&quot;, &quot;Auto&quot;)]" RunCodeAnalysis="[AdvancedBuildSettings.GetValue(Of String)(&quot;RunCodeAnalysis&quot;, &quot;AsConfigured&quot;)]" />
+4
source

Just install the latest nugget package Microsoft.Net.Compilers

https://www.nuget.org/packages/Microsoft.Net.Compilers > .Net compilers. A link to this package will lead to the creation of a project using the specific version of the C # and Visual Basic compilers contained in the package, unlike any installed system.

, , .NET 4.6+ Full Framework.

0

Source: https://habr.com/ru/post/1678991/


All Articles