0
votes

Occasionally, I get build errors after checking my changes to TFS, because the TFS compiler does not support newer syntax like:

auto property initializers

public int X { get; set; } = x;

?. and ?[] null-conditional Operators

int? count = customers?[0]?.Orders?.Count();

The visual studio 2015 compiler does not detect these problems (the project compiles fine), which means that after the build error occurs I usually have to do another checking to remove the invalid syntax from the solution.

Is it possible to change the VS2015 solution somehow, so that these errors are caught before I do the checking to TFS?

1
If the errors occurs on TFS build you can use newer version of MSBuils on the TFS buils step. - Shayki Abramczyk
The TFS server is out of my control. Ideally, I would like fix the issue by fixing VS2015 so that it also spits out errors in case I'm using a newer C# syntax. - bastos.sergio

1 Answers

0
votes

TFS 2013 with XAML build is just using MSBuild to run the build. You could try to use MSBuild command to run the build test first locally, which will narrow down the issue.

If it works well on your dev machine and not works fine from a TFS server build. Very likely the environment problem.

To make sure the build successful, you should keep your build server environment the same with your local environment. Please double check this, such as Visual Studio version.

For trouble shooting, you could try to remote to your build agent manually run your build and test on your build agent.