On this page
Overview
Roslyn is the open-source implementation of the C# and Visual Basic compilers and the .NET Compiler Platform API surface. It exposes syntax trees and semantic compiler models so analyzers, code fixes, refactorings, source generators, and other developer tools can use the same language understanding as the compiler.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Work with compiler syntax trees for C# and Visual Basic
The Syntax API exposes full-fidelity, immutable syntax trees created by the same parser used by the compiler, with nodes, tokens, and trivia available for analysis.
Build code-analysis tools on the compiler's language model
Roslyn APIs let tools reason about code using compiler structures instead of relying only on source-text heuristics.
Best fit
Before adoption
Do not use GitHub Releases latest as the current Roslyn version
GitHub Releases still reports v4.0.1 from 2021 as latest, while stable 5.x packages continue to ship on NuGet. Use NuGet and the target .NET SDK as the package-version authority.
Match compiler API packages to the analyzer or tooling host
Visual Studio, the dotnet SDK, and build servers host particular Roslyn versions. Large package-version gaps can create API compatibility or assembly-loading problems, so choose packages with the deployment host in mind.
Treat syntax trees as immutable during transformations
Roslyn syntax trees are immutable, so transformations construct replacement nodes or new trees rather than mutating the existing syntax graph.
Sources: [2]
Official sources
- [1]Roslyn README(2026-10-04)
- [2]Roslyn C# Syntax Analysis walkthrough(2026-10-04)
- [3]Microsoft.CodeAnalysis.CSharp 5.9.0 on NuGet(2026-10-04)
- [4]Roslyn GitHub latest release v4.0.1(2026-10-04)
- [5]Roslyn MIT license(2026-10-04)
Supplemental curator note
GitHub Releases still reports v4.0.1 from 2021 as the latest release, so it is not a reliable current-version source. For package consumers, use NuGet and the target .NET SDK as the release authority; as of October 4, 2026, Microsoft.CodeAnalysis.CSharp 5.9.0 is the current stable package.
Try it in 3 steps
- 1
Create a console project for code analysis
Create a minimal .NET console project for exercising Roslyn APIs.
dotnet new console -n RoslynDemo -f net10.0 - 2
Add Microsoft.CodeAnalysis.CSharp 5.9.0
Pin the stable package current on October 4, 2026. GitHub Releases latest v4.0.1 is not the current package version.
dotnet add RoslynDemo/RoslynDemo.csproj package Microsoft.CodeAnalysis.CSharp --version 5.9.0 - 3
Parse C# source and print the root syntax kind
Use the same Syntax API family as the compiler to parse source text and verify that a syntax tree is produced.
printf 'using Microsoft.CodeAnalysis.CSharp;\nvar tree = CSharpSyntaxTree.ParseText("class Demo { int X; }");\nConsole.WriteLine(tree.GetRoot().Kind());\n' > RoslynDemo/Program.cs && dotnet run --project RoslynDemo/RoslynDemo.csproj
Growth
Growth trends · Last 30 days
20,702 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 282
- Open PRs
- 742
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- roslyn
- visual-basic
- visual-studio
- csharp
- hacktoberfest
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Svelte88,230 Stars
1 shared tag(s) · 1 shared category(s)
compile components into efficient JavaScript and express reactive UI through runes
JavaScript - CPython77,417 Stars
1 shared tag(s) · 1 shared category(s)
the reference implementation repository for Python, its standard library, build system, and tests
Python - Swift70,457 Stars
1 shared tag(s) · 1 shared category(s)
a cross-platform language combining memory safety, native performance, and C/Objective-C interoperability
Swift - Ruff49,889 Stars
1 shared tag(s) · 1 shared category(s)
combine Python linting and formatting in one Rust-based CLI with 900+ rules, caching, and automatic fixes
Rust - ESLint27,531 Stars
1 shared tag(s) · 1 shared category(s)
Use AST analysis and pluggable rules to turn JavaScript quality checks into repository policy through flat config
JavaScript - Ruby23,771 Stars
1 shared tag(s) · 1 shared category(s)
one upstream for web scripting, the CRuby VM, GC, and YJIT/ZJIT
Ruby
Report incorrect information
Tell us if any listing information is incorrect or outdated.