尽管使用了Microsoft.Net.Compilers nuget包,VS2013上仍存在C#6错误消息 [英] C# 6 error messages on VS2013 despite using Microsoft.Net.Compilers nuget package
问题描述
我们的50人开发团队中,有一半以上仍在使用Visual Studio2013.尽管如此,我们仍想使用C#6.因此,我们尝试使用以下解决方案:
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.
编译可以很好地工作,就像我们的CI环境一样.但是,Visual Studio在与C#6功能有关的错误列表中显示了很多错误.我尝试通过使用干净的解决方案,重建,重新启动Visual Studio并清除ReSharper缓存来消除错误,但没有一个起作用.
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.
推荐答案
即使在项目中安装了 Microsoft.Net.Compilers
程序包,Visual Studio仍将C#5编译器用于编辑器.这就是为什么它编译C#6代码,但编辑器不理解的原因.不幸的是,无法更改编译器编辑器的使用方式,并且
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.
因此,全面支持C#6的唯一方法是升级到Visual Studio 2015.
So the only way for the full C# 6 support is to upgrade to Visual Studio 2015.
这篇关于尽管使用了Microsoft.Net.Compilers nuget包,VS2013上仍存在C#6错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!