C# 6 error messages on VS2013 despite using Microsoft.Net.Compilers nuget package

安稳与你 提交于 2019-12-13 13:18:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!