在 Visual Studio 2013 中使用 Roslyn 编译器 [英] Using Roslyn compiler with Visual Studio 2013

查看:60
本文介绍了在 Visual Studio 2013 中使用 Roslyn 编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 Visual Studio 2013 中使用 Roslyn 编译器,以便我可以利用新的 C# 6 功能?

Is there a way to use the Roslyn compiler with Visual Studio 2013 so that I can take advantage of the new C# 6 features ?

注意:使用 VS 2015 不是一种选择.

推荐答案

,您可以使用 Visual Studio 2013 编译 C# 6 代码.您只需要安装 Microsoft.Net.编译器 NuGet 包,您的代码将构建得很好(但是,请注意,您需要针对 .NET 4.5+).

Yes, you can compile C# 6 code with Visual Studio 2013. You just have to install the Microsoft.Net.Compilers NuGet package and your code will build just fine (however, note that you need to target .NET 4.5+).

但是,IDE 不会理解它.尝试使用 C# 6 功能的任何地方都会出现波浪线,因为 VS2013 的内部实时"编译器不一样.每天在这样的环境中工作不到两周就会让你发疯.

But, the IDE won't understand it. You'll get squiggles everywhere you try to use a C# 6 feature, because VS2013's internal "live" compiler is not the same. Working in such an environment on a daily basis will drive you insane in less than two weeks.

也就是说,如果您只需要编译 C# 6 代码,那么在 VS2013 上安装 NuGet 包是一个潜在的解决方案.

That said, if all you need is compiling C# 6 code, installing the NuGet package on VS2013 is a potential solution.

这篇关于在 Visual Studio 2013 中使用 Roslyn 编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆