Running TFS Build with C# 6.0 features

后端 未结 2 630
暖寄归人
暖寄归人 2020-12-09 04:42

I just recently began using the nameof() operator of C# 6.0 in my projects. Now (upon check-in, duh...) I (or better: the build agent) refused to build the proj

相关标签:
2条回答
  • 2020-12-09 04:54

    I had the same issue with TFS 2015. My build definitions were in the XAML build definitions format - this format does not support C#6 features, even if you specify /p:VisualStudioVersion=14.0 or 15.0 for the MSBuild arguments in the advanced build process parameters.

    Instead, use the new build format. In Visual Studio 2017 (yes, you can use VS 2017 with TFS 2015), it is available under section "Build definitions" (note that below that there is the old section "XAML Build definitions").

    If you create a new build definition this way, a web site opens up where you have to create the build steps. The binary files appear under the "Artefacts" section. Unfortunately, I found no way to convert XAML build definitions to the new format, so you have to create it from scratch.

    In the Visual Studio Build step, ensure that the field "Visual Studio Version" is set to "Latest".

    Hint: To get the right files into your artifacts, you need to define Minimatch patterns. You can find the syntax here, in the example there you can find a copy file pattern for deploying a web project.

    0 讨论(0)
  • 2020-12-09 05:08

    You can either install the "Microsoft Build Tools 2015" on the build agent machine and configure the build template to use that version of msbuild, or else install the Microsoft.Net.Compilers NuGet package in the projects you want to build with the new compiler.

    0 讨论(0)
提交回复
热议问题