Roslyn and .NET Runtime version [duplicate]

自古美人都是妖i 提交于 2019-11-28 02:32:11

问题


Is it possible to use Roslyn compiler and new features of C# 6.0 with old versions of .NET Runtime (for example, .NET 4.0)?

For example, I want use the expression-bodied members (int S => x + y; instead of int S { get { return x + y; } }) in .NET 4.0 application.


回答1:


The new C# 6.0 features don't depend upon framework support so yes, you an app compiled with the C# 6.0 compiler will run on .NET 4.0, assuming of course you specify you are targeting .NET 4.0 in your project file in the first place.




回答2:


As of now Roslyn C# compiler and tooling cannot run on .NET 4.0

You can certainly cross-compile for .NET 4.0, but to run the compiler itself you need at least .NET 4.5



来源:https://stackoverflow.com/questions/24436260/roslyn-and-net-runtime-version

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