C# 6.0 has a brand-new compiler, written entirely in C#. The new compiler is modular, so you can utilize its functionality in many ways besides compiling source code to an executable or library. Known as “Roslyn”, the new compiler makes it easier to write static code analysis and refactoring tools, editors with syntax highlighting and code completion, and Visual Studio plugins that understand C# code.
The Roslyn libraries can be downloaded from NuGet, and there are packages for both C# and VB. As both languages share some architecture, there are common dependencies. The NuGet package ID for the C# compiler libraries is
The source code for Roslyn is publicly available under the Apache 2 open source license. This opens up further possibilities, including morphing C# into a custom or domain-specific language. The source code is available on GitHub, at https://github.com/dotnet/roslyn.
The GitHub site also hosts documentation, examples, and walkthroughs that demonstrate code analysis and refactoring.
.NET Framework 4.6 does not ship with the Roslyn assemblies, and its version of csc.exe invokes the old C# 5 compiler. Installing Visual Studio 2015 remaps csc.exe to the C# 6 (Roslyn) compiler.
Without Visual Studio 2015, you can still programmatically invoke the compiler (and its services) if you download and reference the Roslyn assemblies. But the csc.exe tool that ships with the .NET Framework will remain ...