4

Over half of our 50 man development team still uses Visual Studio 2013. Despite this, we would like to use C# 6. So we tried using this solution: https://stackoverflow.com/a/32010632/3997704.

Compilation with Microsoft.Net.Compilers works fine, as does our CI environment. However, Visual Studio shows a lot of errors in the Error List related to C# 6 features. I tried getting rid of the errors by using clean solution, rebuild, restarting Visual Studio and clearing ReSharper caches but none worked.

Community
  • 1
  • 1
mnwsmit
  • 1,198
  • 2
  • 15
  • 31
  • 3
    Well, the answer you linked to explicitly says this is going to happen. I don't think there's a way to fix that. – svick Mar 04 '16 at 19:50
  • Well, that's one way to interpret "The editor will be thrown off however by these new features." I would have wanted that answer to state this problem before spending time on it since it is not a solution if you get thousands of errors. – mnwsmit Mar 05 '16 at 12:39

1 Answers1

7

Even though you install the Microsoft.Net.Compilers package in your project, Visual Studio still uses the C# 5 compiler for the editor. That's why it compiles the C# 6 code, but the editor doesn't understand it. Unfortunately, there is no way to change the compiler editor uses and probably never will be.

So the only way for the full C# 6 support is to upgrade to Visual Studio 2015.

David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68