1

I am new to working with TFS Builds and for the life of me cannot figure out why I am getting a compilation error on TFS when it builds fine locally.

this is the error message from TFS Build

Line 98 is: enter image description here

Both my workstation and the workstation where the builds are run have the same .NET frameworks. Any help would be appreciated.

aemorales1
  • 312
  • 3
  • 13
  • 1
    I may be wrong, but it seems that TFS build uses compiler version that doesn't understand expression-bodied members. And as it is a language feature, it is not (mostly) dependent on .NET version, so project level .NET version settings won't help to solve it. – Eugene Podskal Jan 12 '17 at 19:28
  • The version of `MsBuild` being called may be different between what you're developing on and what your build server is being told to build on. It's hard to tell with the information you provided. – Matt Jan 12 '17 at 19:29
  • 1
    Possible duplicate of [Running TFS Build with C# 6.0 features](http://stackoverflow.com/questions/31601047/running-tfs-build-with-c-sharp-6-0-features) – Eugene Podskal Jan 12 '17 at 19:29

1 Answers1

2

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 .Net version.

And if you are tfs2013 building the app, please follow below :

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.

Source Link: Running TFS Build with C# 6.0 features

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Thanks for the reply, can you please provide an example of where in the build template I can make the configuration change? I am using XAML Build Definitions within Visual Studio 2015 and don't see an option to set that. – aemorales1 Jan 26 '17 at 21:23
  • 1
    The Build Tools did the trick! Thank you. I apologize for the delay in accepting your answer, I got caught up on project work and this had to be put on the back burner. – aemorales1 Jan 27 '17 at 15:09