Friday, March 25, 2016

TFS Build Error: Invalid expression term '.'

A colleague passed by my desk yesterday with the following question:

We recently moved to Visual Studio 2015 and started to use some of the new C# language features in .NET 4.6, like for example Null Conditional operators. However after doing that our CI build started to fail on the Build server. What I’m doing wrong? Or are there some components missing on the build server?

When I took a look at the failing build I saw the following error messages:

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

Invalid expression term '.'

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

Syntax error, ':' expected

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

; expected

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

Invalid expression term ')'

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

; expected​

I started by checking the build server if .NET 4.6 and the Build tools for Visual Studio 2015 were installed. Both were available…so that was not causing the problem.

I opened up the build definition itself and noticed that an old Build Process template was used(DefaultTemplate.11.1.xaml). This old template doesn’t want to use the latest MSBuild version(for a reason I don’t understand).

image

We switched to the newer TFSVC build template(TfvcTemplate.12.xaml.) reconfigured all the settings and the build was all green again!

 image

No comments: