Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Roslyn compiler with Visual Studio 2013

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 ?

Note: Using VS 2015 is not an option.

like image 605
Ayman Avatar asked Nov 21 '15 18:11

Ayman


People also ask

What is Roslyn .NET core?

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.

Does Visual Studio use Roslyn?

NET compiler platform (Roslyn) package versions are supported for different versions of Visual Studio.

What is the Roslyn compiler and how can I use it?

Roslyn is a collection of open-source compilers, code analysis and refactoring tools which work with C# and Visual Basic source codes. This set of compilers and tools can be used to create full-fledged compilers, including, first and foremost, source code analysis tools.


1 Answers

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+).

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.

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

like image 72
Patrice Gahide Avatar answered Sep 18 '22 18:09

Patrice Gahide