5 years on: Roslyn has changed .NET forever

5 years ago today, Microsoft published a CTP for what they described as "a long lead project which we are considering for the post-Visual Studio 11 timeframe". It would go on to become the .NET Compiler Platform but then, and even today, it was known better by its codename: Roslyn

I maintain that .NET in the last decade has had quite a few pivotal developments that changed the landscape of the ecosystem: .NET Core is the most recent, NuGet springs to mind, and Roslyn has unequivocably proven to be one of them.

Open source

While Roslyn's open source journey only started in 2012 and only moved to GitHub with the rest of Microsoft's open source in 2015, it still has almost 6,500 pull requests, including signficant community contributions from across the .NET developer base. Even more impressively, the .NET team have actively involved the scriptcs team and the whole community to shape the ideal API and Platform experience, going so far as publicly publishing meeting notes on GitHub. Roslyn was one of the first open-source projects from Microsoft I heard about and to me, it signalled a big shift from Microsoft working with open-source projects (such as through MS Open Tech) to Microsoft actually working open-source as the .NET team built the future of the .NET compiler in full open source. I think plenty has been written about Microsoft's open-source journey, but Roslyn really showed how it was done!


The .NET compiler of old, an occasionally frustrating black box had suddenly become a lightning-fast platform designed from the ground up around effective APIs. For me, back then, I was only just getting into .NET development after a frustrating first experience with C# at university. By this point, I barely understood what a compiler even did, so I was mostly enjoying the simple things: Roslyn was fast, it let me use all the cool new language features that made my inner magpie dev excited, and refactoring support meant that the innumerable mistakes my amateur mind made could be fixed without the pain.

Behind the scenes of course, this was all powered by the awesome new code analysis APIs that Roslyn was exposing, powering the next generation of Visual Studio tools as well as an awesome collection of powerful analysers to inspect, improve and analyse code right where you develop. We all know that these awesome analysis capabilities are still improving to this day with ever more powerful refactorings available right out of the box, intelligent hints to improve your code, and fast error checking that let you build real features faster.

Plus, this fast compilation and analysis led to an awesome feature that certainly made my life easier...

Interactive C#

Visual Studio 2015 finally saw the inclusion of the Interactive Window feature, but amazingly a preview of this very feature was in the original CTP release! 5 years on and the Interactive experience has matured and improved dramatically, and has certainly changed the way I use Visual Studio. No longer did we need to spin out new console apps just to test a bit of complex code and no longer were we hamstrung by the limited capabilities of the Locals and Watch windows. The full power of context-aware C# integrated directly into the IDE at design-time and debug-time alike was a revelation! Plus, this meant C# now had the full REPL capabilities other languages had boasted, taking another step away from reliance on Visual Studio.

Still, even with a C# REPL, the best feature (to my mind) is nowhere to be found in Visual Studio.


I would highlight Roslyn as the single biggest driver for the huge array of powerful tools available today using C# as a scripting language. Before Roslyn, C# was the domain of the Visual Studio-wielding app developer. Since then, we have seen the growth of awesome new projects like:

  • scriptcs, the original (and excellent) C# scripting environment
  • Csi, the 45-line (!) interactive C# experience shipped with VS
  • Cake Build, the all-around amazing build system that I have contributed to since 2016
  • Bau, Nake, and several other powerful C# task runners
  • RoslynPad, CShell, OmniSharp (for Roslyn), and all the awesome REPL and IDE tools built on Roslyn.

Plus, we can always go back to basics and hack right on Roslyn using the scripting APIs, a process Dave Glick proved to be so easy a caveman can do it! I strongly believe the Roslyn scripting APIs have been responsible for some of the coolest .NET projects around, and especially important for introducing C# to a huge variety of contexts it would never have otherwise been considered for. After all, most of us are here because we love .NET so this is pretty obviously a great thing!

The future

Now, with Roslyn (and the scripting APIs) having reached real maturity, it's powering the next generation of exciting new technologies and tools.

The fusion of .NET Core and Rolsyn has, for example, led to the very awesome dotnet-script project, led by Roslyn veteran Filip Wojcieszyn. Now, with the lightweight (but soon-to-be-retired) project.json project system, .NET Core and Roslyn, C# has evolved from the heavyweight Visual Studio-centric experience it once was into a super-fast, super-lightweight coding experience that runs across a huge variety of platforms and environments. Now, authoring and running .NET can be as zero-ceremony as:

vi project.json
echo 'Console.WriteLine("hello!");' > program.csx
dotnet restore
dotnet script program.csx

5 years ago today, Microsoft published a seemingly innocent preview, summarising it quite simply:

Traditionally, compilers are black boxes -- source code goes in one end, and object files or assemblies come out the other end. The Roslyn project changes that model by opening up the VB and C# compilers.

Tellingly, the team clearly knew what their project would become:

The Microsoft "Roslyn" CTP previews the new language object models for code generation, analysis, and refactoring, and the upcoming support for scripting and interactive use of C# and Visual Basic.

Today, Roslyn powers the whole .NET ecosystem and I struggle to imagine .NET without it!


comments powered by Disqus