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.
Roslyn, the . NET Compiler Platform, empowers the C# compiler on . NET Core and allows developers to leverage the rich code analysis APIs to perform code generation, analysis and compilation.
The . NET Compiler Platform ("Roslyn") provides open-source C# and Visual Basic compilers with rich code analysis APIs. You can build code analysis tools with the same APIs that Microsoft is using to implement Visual Studio!
Roslyn is an open source platform, developed by Microsoft, containing compilers and tools for parsing and analysis of code written in C# and Visual Basic. Roslyn is used in the Microsoft Visual Studio 2015 environment.
Roslyn was designed with that intent from the beginning. This reduces the barrier in developing tools specifically designed for source code analysis. APIs of Roslyn are of three types: feature APIs, work-space APIs and compiler APIs. Feature APIs allow source code tool developers to do code refactoring and fixes.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With