Roslyn (compiler)

Last updated

.NET Compiler Platform (Roslyn)
Original author(s) Microsoft
Developer(s) .NET Foundation and the open source community
Stable release
.NET 7.0.0 / November 8, 2022;14 months ago (2022-11-08) [1]
Repository github.com/dotnet/roslyn
Written in C#, Visual Basic
Operating system Windows, Linux and macOS
Platform IA-32, x86-64
Type Compiler
License MIT License
Website learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/

.NET Compiler Platform, also known by its codename Roslyn, [2] is a set of open-source compilers and code analysis APIs for C# and Visual Basic (VB.NET) languages from Microsoft. [3]

Contents

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. [4]

Features

Features of Roslyn include:

History

The code name "Roslyn" was first written by Eric Lippert (a former Microsoft engineer [5] ) in a post [6] 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 was filmed. [7]

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

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

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. [3] The project was effectively transferred under the stewardship of the newly founded .NET Foundation. [12] At the same conference, Xamarin announced that they are working on integrating the new compilers and tools in Xamarin Studio. [13]

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 package manager.[ citation needed ]

As of 2013, Roslyn supports VB and C#, and the compilers are written in their respective languages. [14] Roslyn's first release to manufacturing (RTM) was with Visual Studio 2015. [15]

In January 2015, Microsoft moved the Roslyn source code from CodePlex to GitHub. [16]

Architecture

Traditionally .NET compilers have been a black box for application developers. [17] With increasing complexity and demands for source code analysis in modern integrated development environments, however, compilers need to expose application programming interfaces (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 environments (IDEs) like Visual Studio 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. [18] Using an open-source implementation of Common Language Infrastructure (CLI) such as .NET Core, Roslyn will be able to compile in a platform-agnostic manner capable of running CLI code in Linux, OS X, and Windows.[ citation needed ]

See also

Related Research Articles

<span class="mw-page-title-main">Visual Basic (.NET)</span> Object-oriented computer programming language

Visual Basic (VB), originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language, the last version of which was Visual Basic 6.0. Although the ".NET" portion of the name was dropped in 2005, this article uses "Visual Basic [.NET]" to refer to all Visual Basic languages released since 2002, in order to distinguish between them and the classic Visual Basic. Along with C# and F#, it is one of the three main languages targeting the .NET ecosystem. Microsoft updated its VB language strategy on 6 February 2023, stating that VB is a stable language now and Microsoft will keep maintaining it.

<span class="mw-page-title-main">Microsoft XNA</span> Freeware set of tools by Microsoft

Microsoft XNA is a freeware set of tools with a managed runtime environment that Microsoft developed to facilitate video game development. XNA is based on .NET Framework, with versions that run on Windows and Xbox 360. XNA Game Studio can help develop XNA games. The XNA toolset was announced on March 24, 2004, at the Game Developers Conference in San Jose, California. A first Community Technology Preview of XNA Build was released on March 14, 2006.

ASP.NET is a server-side web-application framework designed for web development to produce dynamic web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, applications and services. The name stands for Active Server Pages Network Enabled Technologies.

<span class="mw-page-title-main">SharpDevelop</span>

SharpDevelop is a discontinued free and open source integrated development environment (IDE) for the .NET Framework, Mono, Gtk# and Glade# platforms. It supports development in C#, Visual Basic .NET, Boo, F#, IronPython and IronRuby programming languages.

<span class="mw-page-title-main">C Sharp (programming language)</span> Programming language

C# is a general-purpose high-level programming language supporting multiple paradigms. C# encompasses static typing, strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines.

Dotfuscator is a tool performing a combination of code obfuscation, optimization, shrinking, and hardening on .NET, Xamarin and Universal Windows Platform apps. Ordinarily, .NET executables can easily be reverse engineered by free tools, potentially exposing algorithms and intellectual property, licensing and security mechanisms. Also, code can be run through a debugger and its data inspected. Dotfuscator can make all of these things more difficult.

C# and Visual Basic .NET are the two primary languages used to program on the .NET Framework.

Sandcastle is a documentation generator from Microsoft. It automatically produces MSDN-style code documentation out of reflection information of .NET assemblies and XML documentation comments found in the source code of these assemblies. It can also be used to produce user documentation from Microsoft Assistance Markup Language (MAML) with the same look and feel as reference documentation.

The following tables list notable software packages that are nominal IDEs; standalone tools such as source-code editors and GUI builders are not included. These IDEs are listed in alphabetic order of the supported language.

<span class="mw-page-title-main">MonoDevelop</span> Integrated development environment, discontinued for macOS

MonoDevelop was an open-source integrated development environment for Linux, macOS, and Windows. Its primary focus is development of projects that use Mono and .NET Framework. MonoDevelop integrates features similar to those of NetBeans and Microsoft Visual Studio, such as automatic code completion, source control, a graphical user interface (GUI) and Web designer. MonoDevelop integrates a Gtk# GUI designer called Stetic. It supports Boo, C, C++, C#, CIL, D, F#, Java, Oxygene, Vala, JavaScript, TypeScript and Visual Basic.NET. Although there is no word from the developers that it has been discontinued, nonetheless it hasn't been updated in 4 years and is no longer installable on major operating systems, such as Ubuntu 22.04 and above. Its parent Microsoft, seems to have shifted focus to Visual Studio Code and the .NET Framework, which runs on many operating systems, including Linux.

<span class="mw-page-title-main">Visual Studio</span> Code editor and IDE

Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

Text Template Transformation Toolkit is a free and open-source template-based text generation framework. T4 source files are usually denoted by the file extension ".tt".

<span class="mw-page-title-main">.NET Framework</span> Software platform developed by Microsoft

The .NET Framework is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until being superseded by the cross-platform .NET project. It includes a large class library called Framework Class Library (FCL) and provides language interoperability across several programming languages. Programs written for .NET Framework execute in a software environment named the Common Language Runtime (CLR). The CLR is an application virtual machine that provides services such as security, memory management, and exception handling. As such, computer code written using .NET Framework is called "managed code". FCL and CLR together constitute the .NET Framework.

Windows Runtime (WinRT) is a platform-agnostic component and application architecture first introduced in Windows 8 and Windows Server 2012 in 2012. It is implemented in C++ and officially supports development in C++, Rust/WinRT, Python/WinRT, JavaScript-TypeScript, and the managed code languages C# and Visual Basic .NET (VB.NET).

<span class="mw-page-title-main">Mono (software)</span> Computer software project

Mono is a free and open-source .NET Framework-compatible software framework. Originally by Ximian, it was later acquired by Novell, and is now being led by Xamarin, a subsidiary of Microsoft and the .NET Foundation. Mono can be run on many software systems.

<span class="mw-page-title-main">.NET</span> Free and open-source software platform developed by Microsoft

The .NET platform is a free and open-source, managed computer software framework for Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft employees by way of the .NET Foundation and is released under an MIT License.

Universal Windows Platform (UWP) is a computing platform created by Microsoft and introduced in Windows 10. The purpose of this platform is to help develop universal apps that run on Windows 10, Windows 10 Mobile (discontinued), Windows 11, Xbox One, Xbox Series X/S, and HoloLens without the need to be rewritten for each. It supports Windows app development using C++, C#, VB.NET, and XAML. The API is implemented in C++, and supported in C++, VB.NET, C#, F# and JavaScript. Designed as an extension to the Windows Runtime (WinRT) platform introduced in Windows Server 2012 and Windows 8, UWP allows developers to create apps that will potentially run on multiple types of devices.

C++/WinRT is a C++ library for Microsoft's Windows Runtime platform, designed to provide access to modern Windows APIs. C++/WinRT is provided as a standard C++17 header file library, unlike C++/CX, which is an extension to C++ and requires a recent version of Microsoft Visual C++.

References

  1. "Release .NET 7.0.0". GitHub. December 14, 2021. Retrieved May 5, 2022.
  2. "C# and Visual Basic - Use Roslyn to Write a Live Code Analyzer for Your API". msdn.microsoft.com. Retrieved January 7, 2019.
  3. 1 2 .NET Compiler Platform ("Roslyn") on GitHub
  4. Neil McAllister, Microsoft's Roslyn: Reinventing the compiler as we know it, DEVELOPER_WORLD, 2011-10-20
  5. "Fabulous adventures in coding". About Eric Lippert. Eric Lippert. November 29, 2012.
  6. "Hiring for Roslyn". Eric Lippert's MSDN blog. Eric Lippert. December 16, 2010.
  7. Muir, Pat (October 5, 2014). "Roslyn hopes new TV show brings 15 more minutes of fame". Yakima Herald . Archived from the original on November 2, 2014. Retrieved November 1, 2014.
  8. Microsoft "Roslyn" CTP Archived April 18, 2012, at the Wayback Machine , Microsoft Download Center
  9. Microsoft "Roslyn" CTP, Microsoft Download Center
  10. What's New in the Microsoft "Roslyn" September 2012 CTP, Visual Studio vNext Forums
  11. Known Limitations and Unimplemented Language Features, Visual Studio vNext Forums
  12. .NET Foundation – Open Source Foundation for the .NET Community
  13. "Highlights from Build 2014's Second Keynote". InfoQ. Retrieved December 26, 2021.
  14. Microsoft Roslyn vs. CodeDom
  15. Visual Studio 2015 RTM, 2015-07-20
  16. We're moving to GitHub! Archived December 1, 2015, at the Wayback Machine , MSDN VBTeam Blog, 2015-01-10
  17. "Whitepaper: Roslyn Project Overview". Microsoft .
  18. Overview of Roslyn from GitHub documentation

Further reading