.NET Compiler Platform (“Roslyn”) Preview heading to .NET and Visual Studio vNext

Cesar De la Torre

On April 3rd 2014 (second day of //BUILD 2014) Microsoft released a new preview version of “Roslyn”, with an official name: .NET Compiler Platform. which will be part of the next version of .NET and Visual Studio, but you can try it right now on top of VS 2013.

What is the .NET Compiler Platform (“Roslyn”)

The .NET Compiler Platform Preview (“Roslyn”) is a major update of the C# and VB compilers. But, “Roslyn” is not just about compilers but an open platform providing an API that provides an object model on top of the C# and VB compilers and language services so anyone can extend the development experience enriching the IDE with refactoring, code analysis and custom diagnostics.

“Roslyn” itself is fully implemented by using just .NET languages, that shows the kind of powerful applications you can implement with managed code if you can create such a complex and critical compiler platform by using C#.

I really want to highlight that “Roslyn” is the basis for the next .NET and Visual Studio wave. Microsoft has been working on “Roslyn” for quite a few years, many developers were aware about it, but now is when it is getting serious and everything in C#/VB and Visual Studio will be based on top of “Roslyn”. Yes, right now is a preview, but I tell you, this is gonna be mainstream.

Open platform providing API

Like I mentioned, the great thing about the .NET Compiler Platform is precisely the “platform” area, the API that it provides. Anyone can now pretty easily use that API from a custom Visual Studio plug-in and extend the developer experience, by providing refactoring tools, code analysis and custom diagnostics. And this is not targeting just tools coming from real market products, even any organization (development teams, customer, system integrator, etc.) could create their extensions in order to have for instance custom diagnostics that are checking that the code being created by the team is aligned to their coding policies within their organization or development teams. I think it is pretty cool and the number of ideas to think about is huge!.

In previous and current versions of Visual Studio and .NET languages (up to Visual Studio 2013), the C# and VB compilers were like black boxes that take C#/VB source code and generate the IL assemblies. For that reason (no external API available), it was pretty hard to extend and enrich the development experience as it was not design as an open platform with an API to be used by third party developers/tooling.

With “Roslyn” we have opened the box and it is not anymore just about compilers but a whole open platform for developers, like I illustrated in the following image that we’re also using in //BUILD 2014 sessions.


But, in my case, I thought right away about AOP (Aspect Oriented Programming), implementing my own custom aspect attributes and aspect weavers, then generating code for those aspects at compilation time. But, I have to warn you that for this version, even when “Roslyn” exposes different parts of the compiler pipeline, at this time, AOP is not supported as a first-class concept in the .NET Compiler Platform. When discussing about this AOP scenario with the “Roslyn” product group, the conclusion was that Microsoft is considering new scenarios for future releases, but right now, even when it could be possible to implement AOP, it might be pretty tricky the way you could do it… I might try a shot in the near future, and if I get to any cool experiment result, I will link to it from this post.

Why the codename “Roslyn”? 🙂

Well, “Roslyn” is the codename, so in the same way that other Microsoft technologies got towns’ names like Dublin, Everett, Whidbey island, etc. for their codenames, “Roslyn” is also a village/town near Seattle. Just as an informal joke, here I show a picture I took from “ROSLYN CAFE”, at Roslyn village, 85 miles away from Redmond (Seattle, in Washington state), going thru the I-90. I guess that fans of “Northern Exposure” will remember that picture… No, it was not in Alaska! 😉 



“Roslyn” is OPEN SOURCE!

This is so cool!, starting on April 2014 (BUILD timeframe), “Roslyn” is OPEN SOURCE. You can go and see how it is internally implement by just diving into the source code at http://roslyn.codeplex.com or even attaching to your code (e.i. if you are building any VS plug-in using Roslyn API) and debugging Roslyn’s code, so you can completely understand what’s going on under the covers. 🙂

Even more, you could also fork “Roslyn” for your own experiments, and of course, the product group will be accepting contributions from the .NET community in an incremental way. Microsoft will probably start accepting contributions related to bugs, then, in the future could be accepting new features, as well.

“Roslyn” at the .NET Foundation organization

Starting at the same timeframe (//BUILD 2014), the .NET Foundation organization has been created in order to foster open development, collaboration and community engagement on the .NET platform. The .NET Foundation includes popular open source .NET projects such as the .NET Compiler Platform (“Roslyn”), ASP.NET MVC, Entity Framework, Xamarin’s projects, and many others. The list will be growing pretty fast. Read the full announcement here.image


Developer usage scenarios for the .NET Compiler Platform

Basically, being a developer, you can have the following three main scenarios:


SCENARIO 1. Out of the box language innovation availability (C# and VB) to any developer. Roslyn provides an easier way for Microsoft to innovate on language features and create richer IDE developer experience that any developer can benefit from.

SCENARIO 2. Because Roslyn is a Compiler Platform that provides a public API, that allows third parties to extend the Visual Studio development experience. If you are an ISV creating tools or plugins for Visual Studio that is great news for you, but even if you are an organization that just works with Visual Studio, you can also benefit of this API by creating custom diagnostics and code analysis ensuring that certain practices are followed by your developers.

SCENARIO 3. Finally, since “Roslyn” is Open Source, that enables the vibrant .NET community to deeply understand how Roslyn works internally, how to extend the developer experience, take part on the future direction of the .NET compilers thru contributions and even fork its code.


How can I try the new .NET Compiler Platform preview bits released at //BUILD 2014?

For this preview version of “Roslyn”, you need to use it on top of Visual Studio 2013 UPDATE 2 RC. Then, you can get the bits from https://aka.ms/NetCompilerPlatformDownload and install it.

Enjoy it!, this is really cool stuff and shows just part (in this case, within the core of .NET) of the largest innovation and investment that Microsoft is doing for .NET while heading to the next version of .NET and Visual Studio. Good times for .NET are coming! 🙂


Discussion is closed.

Feedback usabilla icon