.NET Compiler Platform

From Wikipedia, the free encyclopedia
  (Redirected from Microsoft Roslyn)
Jump to: navigation, search

.NET Compiler Platform, better known by its codename "Roslyn", is a set of open-source compilers and code analysis APIs for C# and Visual Basic .NET languages from Microsoft.[1]

The project notably includes self-hosting versions of the C# and VB.NET compilers – compilers written in the languages themselves. The compilers are available via the traditional command-line programs but also as APIs available natively from within .NET code. Roslyn exposes modules for syntactic (lexical) analysis of code, semantic analysis, dynamic compilation to CIL, and code emission.[2]



Microsoft made a community technology preview (CTP) available for public download in October 2011. It installs as an extension to Visual Studio 2010 SP1.[3]

The CTP was updated on September 2012[4] to include many updates to the Roslyn APIs introduced in the June 2012 and October 2011 CTPs, including breaking changes.[5] While the June 2012 CTP API is complete for the compilers, not all features have been implemented for the C# and VB.NET languages.[6]

At the Build 2014 conference in San Francisco April 2014, Microsoft made the "Roslyn" project open-source and released a preview of the language integration for Visual Studio 2013. As of April 3, 2014, Roslyn is under the Apache License 2.0.[1] The project was effectively transferred under the stewardship of the newly founded .NET Foundation.[7] At the same conference, Xamarin announced that they are working on integrating the new compilers and tools in Xamarin Studio.

The compilers are not feature-complete in this release. Each of the compilers contains features that are planned for the coming language versions (C# 6 and Visual Basic.NET 14). The APIs are also available through the NuGet package manager.

Roslyn's first RTM release was with Visual Studio 2015.[8] Roslyn currently only supports VB and C#, and the compilers were written in their respective languages. In January 2015[9] Microsoft moved the Roslyn source code from CodePlex to GitHub.


Traditionally compilers are a black box for developers. However with increasing complexity and demands of source code analysis in modern integrated development environment, compilers need to expose application program interfaces (API) that will help developers to directly perform phases of compilation such as lexical and syntactic structure analysis of source code. Roslyn was designed with that intention from the beginning. This reduces the barrier in developing tools specifically designed for source code analysis. APIs of Roslyn are of three types namely feature API, work-space API and Compiler API. Feature API allow source code tool developers to do code refactoring and fixes. Work-space API allow plugin developers to do action specifically needed in Integrated Development Environments like Visual Studio such as finding references of a variable or code formatting. Compiler API allows even more sophisticated analysis of source code, by exposing direct calls to do syntax tree and binding flow analysis.[10] Using opensource version of .Net called .Net Core Roslyn will be able to compile in a platform agnostic manner capable of running .Net code in Linux, Mac OS X and Windows.


External links[edit]