We use TFS 2013 to as our build server. I've started a C# 6.0 project and I am trying to get it to build. I am using the new null-conditional operators, and my build chokes. I've tried installing several things on the TFS server, including the targeting pack and VS 2015. I've tried providing /tv:14.0 to the MSBuild arguments.
Configuration\EntityEntityConfig.cs (270): Invalid expression term '.'
Configuration\EntityEntityConfig.cs (283): Invalid expression term '.'
Configuration\EntityEntityConfig.cs (283): Syntax error, ':' expected
... etc.
At this point, I have no idea what else to try. Any suggestions would be greatly appreciated.
People using TFS 2012 have reported success using:
/tv:14.0 /p:GenerateBuildInfoConfigFile=false /p:VisualStudioVersion=14.0
as arguments to MSBuild. Perhaps this might work for you, but so far this does not work for my TFS 2013 build agents.
Update: I finally got this to work on TFS 2013. Here is what I had to do:
It seems that the /tv:14.0 command argument doesn't work as expected. See: BuildActivity ignores ToolsVersion
As a workaround, you need to customize the build process template:
If you choose to install VS 2015 on the build machine, there's an important step: open it for first use, and make sure it's licensed. Otherwise, you'll continue to experience build failures.
If you run the DefaultTempalte.11.1.xaml then find the msbuild activity (there are 2 in this template and their label is "Run MSBuild for Project") and change the ToolPath property to the path of the msbuild toolset (for me that was "C:\Program Files (x86)\MSBuild\14.0\Bin").
Nothing else is necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With