4

Is Roslyn the default compiler in Visual Studio 2017?

I found this article which tells that Roslyn is not the default compiler and you should install Nuget packages to enable Roslyn.

Nuget packages:

Microsoft.CodeDom.Providers.DotNetCompilerPlatform

Microsoft.Net.Compilers

But I also saw an answer on stackoverflow that says, Roslyn is the default compiler starting from VS 2015.

And when i am install that nuget packages, it's creating a new folder in /bin with name 'roslyn' enter image description here

Arman Sahakyan
  • 193
  • 2
  • 9

1 Answers1

4

Yes, Roslyn is the default compiler in Visual Studio.

In the article you link, it only says you need to install it separately if you are trying to use it without Visual Studio:

To date, Roslyn has remained a part of Visual Studio 2015 and is installed together with it. Roslyn is a part of Visual Studio 2017 as well. It has been released in March 2017.

However, Roslyn is not included in the .NET Framework. Even in the .NET Framework 4.6 version, the traditional csc.exe and vbc.exe compilers are included. This is done for it to be compatible with previous .NET Framework versions.

To install Roslyn compilers without installing Visual Studio, you need to download and install Microsoft Build Tools. Roslyn can also be downloaded from Github, then you can compile and get binary files csc.exe and vbc.exe, which can be accessed from the command line.

You would typically only need those NuGet packages if you were building an application or service for compiling code (or similar), which is what that article is about. That is, when your application is actually using Roslyn at runtime to process code, rather than itself being built with Roslyn.

Community
  • 1
  • 1
Ergwun
  • 12,579
  • 7
  • 56
  • 83