问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/35796001/c-sharp-6-error-messages-on-vs2013-despite-using-microsoft-net-compilers-nuget-p