roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
Microsoft's open-source C# and Visual Basic compiler that exposes its internals as APIs, powering code completion, refactoring, and analysis tools in Visual Studio and other editors.
Roslyn is Microsoft's open-source compiler for the C# and Visual Basic programming languages, and it is what actually turns code written in those languages into software that computers can run. What makes Roslyn unusual compared to traditional compilers is that it exposes its inner workings as a public set of programming interfaces (APIs), meaning other developers can tap into the compilation process to read, analyze, and even modify code programmatically.
In practical terms, Roslyn is the engine powering a huge range of developer tools: the code-completion suggestions you see while typing in Visual Studio, the red underlines that appear when you write something invalid, automated refactoring tools that rename variables across an entire project, and code analyzers that flag stylistic or security issues. All of these use Roslyn's APIs to understand the structure of code in a fine-grained way — not just as raw text, but as a structured tree of meaningful pieces (statements, expressions, method calls, etc.).
Developers would interact with Roslyn directly when building their own code analysis or transformation tools: things like custom linters that enforce team coding standards, IDE extensions, automated code migration scripts, or documentation generators. You would not normally interact with Roslyn as an end user; it is infrastructure that the tools you already use are built on top of. It is written in C#, runs on the .NET platform, and its packages are distributed via NuGet, the standard package manager for the .NET ecosystem.
Where it fits
- Build a custom code analyzer that flags rule violations in C# files and integrates as a NuGet package in any .NET project.
- Write an automated script that reads a C# codebase and transforms it, renaming types, updating API calls, or migrating patterns.
- Create a VS Code or Visual Studio extension that adds custom code suggestions or quick-fix actions.
- Build a documentation generator that parses C# source code and extracts structured information about types and methods.