.NET Compiler Platform, also known by its codename Roslyn, is a set of
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
s and
code analysis
In computer science, static program analysis (also known as static analysis or static simulation) is the analysis of computer programs performed without executing them, in contrast with dynamic program analysis, which is performed on programs duri ...
API
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
s for
C# and
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to:
* Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (classic), the original Visual Basic suppo ...
(VB.NET) languages from
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
.
[.NET Compiler Platform ("Roslyn")]
on GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
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
Lexical may refer to:
Linguistics
* Lexical corpus or lexis, a complete set of all words in a language
* Lexical item, a basic unit of lexicographical classification
* Lexicon, the vocabulary of a person, language, or branch of knowledge
* Lexical ...
) analysis of code, semantic analysis, dynamic compilation to
CIL, and code emission.
Features
Features of Roslyn include:
* Compilers for the
C# and
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to:
* Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (classic), the original Visual Basic suppo ...
languages exposed as services via APIs.
* APIs for
code analysis
In computer science, static program analysis (also known as static analysis or static simulation) is the analysis of computer programs performed without executing them, in contrast with dynamic program analysis, which is performed on programs duri ...
and
refactoring
In computer programming and software design, code refactoring is the process of restructuring existing source code—changing the '' factoring''—without changing its external behavior. Refactoring is intended to improve the design, structure, ...
.
History
The code name "Roslyn" was first written by
Eric Lippert (a former
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
engineer) in a post that he published in 2010 to hire developers for a new project. He first said that the origin of the name was because of
Roslyn, Washington, but later in the post he speaks ironically about the "northern exposure" of its office; the city of Roslyn was one of the places where the television series ''
Northern Exposure
''Northern Exposure'' is an American comedy-drama television series about the eccentric residents in the fictitious town of Cicely, Alaska, that originally aired on CBS from July 12, 1990, to July 26, 1995, with a total of 110 episodes. It rec ...
'' was filmed.
Microsoft made a
community technology preview
The software release life cycle is the process of developing, testing, and distributing a software product (e.g., an operating system). It typically consists of several stages, such as pre-alpha, alpha, beta, and release candidate, before the fi ...
(CTP) available for public download in October 2011. It installed as an extension to
Visual Studio 2010
Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms ...
SP1.
The CTP was updated in September 2012 to include many updates to the Roslyn APIs introduced in the June 2012 and October 2011 CTPs, including
breaking changes. While the June 2012 CTP API is complete for the compilers, not all features were implemented for the C# and VB.NET languages.
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. , Roslyn is under the
Apache License
The Apache License is a permissive free software license written by the Apache Software Foundation (ASF). It allows users to use the software for any purpose, to distribute it, to modify it, and to distribute modified versions of the software ...
2.0.
[ The project was effectively transferred under the stewardship of the newly founded .NET Foundation. At the same conference, ]Xamarin
Xamarin is a Microsoft-owned San Francisco-based software company founded in May 2011 by the engineers that created Mono (software), Mono, Mono (software)#Xamarin.Android, Xamarin.Android (formerly Mono for Android) and Mono (software)#Xamarin.i ...
announced that they are working on integrating the new compilers and tools in Xamarin Studio.
The compilers were 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
NuGet (pronounced "New Get")[And The Winner Is, NuGet](_blank)
haacked ...
package manager.
, Roslyn supports VB and C#, and the compilers are written in their respective languages. Roslyn's first release to manufacturing
The software release life cycle is the process of developing, testing, and distributing a software product (e.g., an operating system). It typically consists of several stages, such as pre-alpha, alpha, beta, and release candidate, before the fi ...
(RTM) was with Visual Studio 2015
Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms ...
.
In January 2015, Microsoft moved the Roslyn source code from CodePlex to GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
.
Architecture
Traditionally .NET compilers have been a black box for application developers. With increasing complexity and demands for source code analysis in modern integrated development environments, however, compilers need to expose application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
s (APIs) 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 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. Work-space APIs allow plugin developers to perform actions specifically required in integrated development environment
An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
s (IDEs) like Visual Studio
Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development ...
such as finding references of a variable or code formatting. Compiler APIs allow even more sophisticated analysis of source code, by exposing direct calls to perform syntax tree and binding flow analysis.Overview of Roslyn
from GitHub documentation Using an open-source implementation of
Common Language Infrastructure
The Common Language Infrastructure (CLI) is an open specification and technical standard originally developed by Microsoft and standardized by International Organization for Standardization, ISO/International Electrotechnical Commission, IEC (ISO/ ...
(CLI) such as
.NET Core, Roslyn will be able to compile in a platform-agnostic manner capable of running CLI code in
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
,
OS X
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, and
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
.
See also
*
List of compilers
This page is intended to list all current compilers, compiler generators, Interpreter (computing), interpreters, translators, tool foundations, Assembler (computing), assemblers, automatable command line interfaces (Shell (computing), shells), et ...
*
Microsoft Phoenix
References
Further reading
*
*
*
External links
*
Introducing the Microsoft “Roslyn” CTPon the ''C# Frequently Asked Questions'' MSDN blog
Throwing the Big Switch on Roslynon the ''C# Frequently Asked Questions'' MSDN blog
{{Microsoft FOSS
Compiler Platform
Compilers
Microsoft free software
Software using the MIT license