Curated list of Roslyn books, tutorials, open source projects, analyzers, code fixes, refactorings, and source generators.
Roslyn, officially named .NET Compiler Platform, is a set of open-source compilers and code analysis APIs for C# and Visual Basic .NET languages.
Contents
- Books
- Tutorials
- Open Source Projects
- Open Source Analyzers, Code Fixes, and Refactorings
- Libraries and Frameworks for Testing Analyzers, Code Fixes, and Refactorings
- Source Generators
- Blog Posts and Articles
- Talks
Books
Awesome books to give you a good start with Roslyn.
- Roslyn Succinctly - Free e-book by Alessandro Del Sole and the perfect book to start with. Explains Roslyn APIs and afterward focuses on writing analyzers and refactorings.
- .NET Development Using the Compiler API - Book by Jason Bock. Besides analyzers and refactorings, it also explains the scripting API and provides an interesting reflection on the future of the Compiler API.
- Roslyn Cookbook - Book by Manish Vasani, a member of the Roslyn analyzers team. After covering analyzers, refactorings, and scripting in detail, the book goes in-depth explaining how to develop new C# language features and contribute to the Roslyn source code.
Tutorials
Awesome online tutorials to help you write your first analyzers, code fixes, and source generators.
- Learn Roslyn Now - Series of blog posts that explore the Roslyn compiler API. It introduces the power of Roslyn through small self-contained examples. A perfect tutorial to start with :-)
- How To Write a C# Analyzer and Code Fix - The mother of all Roslyn tutorials :-) A realistic step-by-step introduction to syntax and semantic analysis as well as the syntax transformation.
- C# and Visual Basic - Use Roslyn to Write a Live Code Analyzer for Your API - Older but still not outdated, very detailed MSDN article on writing code analyzers.
- C# - Adding a Code Fix to Your Roslyn Analyzer - The sequel to the previous MSDN article. A detailed introduction into code fixes.
- Introducing C# Source Generators - Original announcement of the C# 9.0 Source Generators feature. Explains what source generators are, in which scenarios they are useful, and shows how to write a simple source generator.
- New C# Source Generator Samples - Samples on how to write a non-trivial code generator driven by additional, non-code files like CSV files or Mustache templates.
- C# Source Generators - Comprehensive list of additional learning sources, samples, and experimental and productive source generators. A perfect reference once you grasp the basics.
Open Source Projects
Awesome open source projects built on top of Roslyn.
- Bridge - C# to JavaScript transpiler. Write modern mobile and web apps in C# and run them anywhere in JavaScript.
- Code Converter - C# to VB.NET and VB.NET to C# transpiler.
- CodeAnalysis.CSharp.PatternMatching - Intuitive pattern matching for Roslyn syntax trees. Simplifies C# syntax and semantic analysis.
- CodeGeneration.Roslyn - Roslyn-based Code Generation during a build with design-time support.
- dotnet-script - Runs C# scripts from the .NET CLI, defines NuGet packages inline and edit/debugs them in VS Code.
- FlubuCore - Cross platform build automation tool for building projects and executing deployment scripts using C# code.
- MirrorSharp - Online C#, VB.NET, and F# code editor. Features code completion, method signature help, quick fixes, and diagnostics.