0

I have a WPF Project, which I build with FAKE. However, since I am using C# Elements like

if (value is Datatype variable){
    //CODE
}

I am no longer able to build the Program but from VS I can run it. I think the Problem is that I use a newer Compiler Version in VS. Can I Change the Compiler Version from FAKE or can I force my build-script to use a specific Version. I have tried to remove these Features to check if the Problem is really on this Syntax.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • I have also tried to install the Microsoft.Net.Compilers package – Gonzo Gonzales May 18 '18 at 07:58
  • "_...am no longer able to build..._" What errors do you get? – Peter Abolins May 18 '18 at 09:53
  • As Kevin Smith wrote I want to use C# 7 Features for the example from my Post when I use the IF expression from I get this exception: Classname.cs(13,46): error CS1026: ) expected Classname. cs(13,60): error CS1002: ; expected Classname .cs(13,60): error CS1513: } expected – Gonzo Gonzales May 23 '18 at 06:32

1 Answers1

1

Looks like you're using some C# 7 features and FAKE is not running MSBuild with language version of 7, add the following to your csproj

<PropertyGroup>
  <LangVersion>latest</LangVersion>
</PropertyGroup>

It will force the compiler to use the latest language version

Kevin Smith
  • 13,746
  • 4
  • 52
  • 77