explaingit

dotnet/roslyn

Analysis updated 2026-06-21

20,414C#Audience · developerComplexity · 4/5Setup · moderate

TLDR

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.

Mindmap

mindmap
  root((repo))
    What it does
      Compiles C# and VB
      Exposes compiler APIs
    Tools it powers
      Code completion
      Refactoring
      Error highlighting
    Developer uses
      Custom analyzers
      Code migration
      IDE extensions
    Tech
      C# dotnet
      NuGet packages
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a custom code analyzer that flags rule violations in C# files and integrates as a NuGet package in any .NET project.

USE CASE 2

Write an automated script that reads a C# codebase and transforms it, renaming types, updating API calls, or migrating patterns.

USE CASE 3

Create a VS Code or Visual Studio extension that adds custom code suggestions or quick-fix actions.

USE CASE 4

Build a documentation generator that parses C# source code and extracts structured information about types and methods.

What is it built with?

C#.NETNuGetVisual Basic

How does it compare?

dotnet/roslynjasontaylordev/cleanarchitecturepeass-ng/peass-ng
Stars20,41420,05019,838
LanguageC#C#C#
Setup difficultymoderatemoderateeasy
Complexity4/53/52/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

Requires .NET SDK and understanding of Roslyn's syntax tree and semantic model APIs before writing useful tooling.

In plain English

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.

Copy-paste prompts

Prompt 1
Using the Roslyn API in C#, show me how to parse a C# source file into a syntax tree and print all method names found in it.
Prompt 2
How do I write a Roslyn analyzer that flags any method longer than 50 lines and shows a warning in Visual Studio?
Prompt 3
Show me how to use Roslyn's workspace API to load a .csproj solution and find all usages of a specific method across the project.
Prompt 4
How do I use Roslyn to automatically rename a class and all its references across a C# solution programmatically?
Prompt 5
Show me how to create a Roslyn code fix provider that automatically adds a missing using directive when the analyzer flags it.

Frequently asked questions

What is roslyn?

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.

What language is roslyn written in?

Mainly C#. The stack also includes C#, .NET, NuGet.

How hard is roslyn to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is roslyn for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub dotnet on gitmyhub

Verify against the repo before relying on details.