Roslyn and .NET Runtime version [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:15:02

问题:

This question already has an answer here:

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



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