dotnet-roslynator

Configure Roslynator analyzers and CLI for C# static analysis, auto-fixes, and dead-code detection.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-roslynator-zhenpenglai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-roslynator
Source: https://github.com/zhenpengLai/myuseskill/tree/main/dotnet-roslynator
Command: npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-roslynator-zhenpenglai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? .NET teams often need broader static analysis than the built-in SDK analyzers provide, but adding Roslynator without a plan causes rule conflicts with StyleCop, Meziantou, or dotnet format. This Skill guides the deliberate adoption of Roslynator analyzer packages and its optional CLI with clear rule ownership and reproducible commands. ## Core Features & Use Cases - Analyzer Package Setup: Detect existing analyzer state, install Roslynator.Analyzers via NuGet, and configure rule severity in .editorconfig. - CLI Workflows: Adopt the Roslynator CLI for analyze, fix, find-unused, and format flows with bounded, rebuild-verified auto-fixes. - Rule Ownership Planning: Avoid duplicate diagnostics across analyzer packs by assigning severity ownership in .editorconfig. - Use Case: A team wants to find unused code before a release. The Skill bootstraps the CLI, runs roslynator find-unused on the solution, and returns a structured status report with verification evidence. ## Quick Start Ask the assistant to add Roslynator analyzers to your .NET solution and configure rule severity in the root .editorconfig.

Frequently Asked Questions about dotnet-roslynator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Roslynator analyzers to a .NET project?▼

Add the Roslynator.Analyzers NuGet package with `dotnet add PROJECT.csproj package Roslynator.Analyzers`, then configure rule severity in your root .editorconfig. Build the solution to enforce the diagnostics at compile time.

How do I find unused code with Roslynator CLI?▼

Install the CLI with `dotnet tool install roslynator.dotnet.cli`, then run `roslynator find-unused MySolution.sln`. Build the solution first so Roslynator has compiled context for accurate analysis.

What is the difference between Roslynator analyzers and the Roslynator CLI?▼

The analyzer NuGet packages provide build-enforced diagnostics during compilation, while the CLI is a separate tool for explicit analyze, fix, format, and find-unused workflows. The CLI does not supply the analyzer rules by itself.

Can Roslynator conflict with StyleCop or other analyzers?▼

Yes, overlapping rules can produce duplicate diagnostics. Resolve this by assigning explicit severity ownership in .editorconfig, disabling Roslynator rules that StyleCop or SDK analyzers already handle.

When should I not use Roslynator?▼

Avoid it when the repo already has overlapping analyzer packs with no consolidation plan, or when the work is formatting-only and the team has standardized on dotnet format or CSharpier.

Is it safe to run roslynator fix on a whole solution?▼

Treat auto-fix as a controlled change: run it on a bounded target first, rebuild, and rerun tests before expanding scope. The CLI exit code 1 indicates diagnostics remain after the fix pass.