BipinPaul.DotNet.CodeStyle 1.0.10

dotnet tool install --global BipinPaul.DotNet.CodeStyle --version 1.0.10
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local BipinPaul.DotNet.CodeStyle --version 1.0.10
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=BipinPaul.DotNet.CodeStyle&version=1.0.10
                    
nuke :add-package BipinPaul.DotNet.CodeStyle --version 1.0.10
                    

BipinPaul.DotNet.CodeStyle

NuGet

A reusable .NET global tool (csharp-style) that makes any C# repo's formatting explicit, deterministic, and LLM-agent-friendly — and keeps it that way with one command.

It runs two ordered passes over your code:

  1. ReSharper cleanupcode (the free CLI, no license) with a ReorderOnly profile — reorders type members to match StyleCop SA1201/1202/1203 (kind → access → constants). dotnet format cannot reorder members; this fills that gap.
  2. dotnet format --severity info — whitespace, var→explicit types, always-braces, file-scoped namespaces, and the modern-C# rules your .editorconfig defines at suggestion level.

Order matters: reorder first, format last, so dotnet format always gets the final word on whitespace.

Install

Available on NuGet:

# global tool
dotnet tool install --global BipinPaul.DotNet.CodeStyle

# or as a repo-local tool
dotnet new tool-manifest        # if you don't have one
dotnet tool install BipinPaul.DotNet.CodeStyle

Build / pack / publish locally (Fallout)

./build.ps1 Pack     # Clean -> Restore -> Compile -> Pack  (artifacts/Packages)
./build.ps1 Push --NuGetPAT <key>   # also pushes to nuget.org

# install the freshly packed build to test it
dotnet tool install --global --add-source ./artifacts/Packages BipinPaul.DotNet.CodeStyle

Use

cd your-csharp-repo

csharp-style init            # scaffold config (run once per repo)
dotnet tool restore          # install the ReSharper CLI the tool needs
csharp-style run --all       # normalize the whole solution once (big diff)
csharp-style run             # afterwards: format changed files only

init scaffolds

  • .editorconfig — the agent-optimized ruleset (explicit types, braces, naming, modern C#, documented severity model)
  • <solution>.DotSettings — the ReorderOnly cleanup profile + a member layout aligned to StyleCop (named to match your .slnx/.sln so ReSharper auto-loads it)
  • Directory.Build.props — adds StyleCop.Analyzers (member-ordering rules) and EnforceCodeStyleInBuild (runs the .editorconfig rules at build, not just the IDE)
  • .config/dotnet-tools.json — pins the free JetBrains.ReSharper.GlobalTools
  • .gitattributes — cross-platform LF line endings
  • AGENTS.md — concise C# conventions for AI agents (merged, your own content kept)
  • .csharp-style.json — optional exclude globs (auto-fills build/** if it detects an isolated build project)

Existing files are never clobbered (it skips or merges; use --force to overwrite .editorconfig/.DotSettings).

run flags

flag effect
--all / -a whole solution instead of changed files
--base <ref> files changed vs a git ref
--list / -l list files, don't run
--no-reorder skip the cleanupcode pass (format only)
--exclude <glob> exclude paths (repeatable; merged with .csharp-style.json)
--solution <f> force a specific .sln/.slnx

Agents vs. humans

The scaffolded AGENTS.md tells AI agents to run csharp-style run --no-reorder — the format pass only: fast, no ReSharper CLI, and safe to repeat. Member ordering is left to the build/CI (StyleCop), so agents don't pay the heavier reorder cost on every run. To also reorder locally, run csharp-style run with no flag — it's thorough but loads the whole solution, so it takes a while.

How it adapts to any repo

  • Auto-detects the solution (*.slnx preferred, else *.sln).
  • Derives the in-solution project directories from the solution file, so changed-file scoping works without hardcoded folder names.
  • Reads excludes from .csharp-style.json so per-repo quirks (e.g. an isolated Fallout build/ project) stay out of the pipeline.

Known limitation

SA1204 (static-before-instance within an access group) is shipped as a suggestion, not a warning: ReSharper's reorderer can only sort instance-first, so static-first within an access group isn't auto-enforced without an unwieldy access×static layout. Everything else (kind, access, constants) is auto-fixed.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.10 102 9/9/2026
1.0.9 95 9/9/2026
1.0.8 190 7/7/2026
1.0.7 124 7/7/2026
1.0.6 117 7/7/2026