Some people in our team are using VisualStudio 2015 while the rest is still using 2013 (both with ReSharper 9.1). The Target Framework in the project properties is set to .NET Framework 4.5.1.
My Problem: I can still use code like
public int X() => x;
which is a .NET 4.6 feature. When I build the project, it also runs (I guess because it's more or less syntactical sugar, so the compiler makes code that doesn't require .NET 4.6). My colleagues however are not very amused, when they check out my changes in Visual Studio 2013 ;-)
Is it possible to get warnings / compile errors in Visual Studio 2015 for using .NET 4.6 features?
That is an expression-bodied member and it is a new language feature introduced in C# 6.0.
The language and the framework/runtime libraries are versioned separately.
What you really want to do is change the language version.
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