Thanks to this post, I was able to use TFS 2012 continuous integration with build server building C# 6 syntax using Visual studio 2017. Hopefully this will save the next person some time in trying to figure this out.
Here are the list of things I have changed in order to get TFS 2012 to build c# 6 syntax. On the machine with the build agent, install vs 2017 enterprise, on the installation setup page, make sure MS build is selected
Edit the Build definition and make sure the MSBuild Argument is /tv:15.0 /p:GenerateBuildInfoConfigFile=false /p:VisualStudioVersion=15.0
Check the template your build definition is using and modify it by going to the source control explorer and going into the team project and undert BuildProcessTemplate, it should have the .xaml file, modify it by double clicking on it
There should be 2 actions that say Run MSBuild for Project. You need to change both of their toolpath property to point to the msbuild.exe parent folder on the build server. In my case, the build server is a 32 bit machine so the path to the Bin folder doesn't have (x86) next to Program Files, you need to check your build server to enter the correct path here.
After you have made the changes, you need to save the xaml and check it in.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…