What to put in an AGENTS.md for .NET
Agents learned .NET from versions now out of support, so state the SDK pinned in global.json, the target framework, and which runner dotnet test uses. Since .NET 10, dotnet new sln writes .slnx, and dotnet test can run on Microsoft.Testing.Platform.
By Himanshu Singh · Updated · How we score →
Which commands should it list?
dotnet buildthe solution or project in the current directorydotnet test --filter "FullyQualifiedName~Orders"a subset; TUnit uses--treenode-filterdotnet format --verify-no-changesfails if formatting would change a filedotnet user-secrets set "Db:Password" "…"development secrets, kept out of the repo
Write them as your repo runs them, with its package manager and flags, plus how to run one test.
What layout should it explain?
- Which solution file is canonical (
.slnxor.sln), and which project starts the app. - Where
global.jsonandDirectory.Packages.propsare, and that versions go there, not in each.csproj. - Which projects are tests, and whether they run on VSTest or Microsoft.Testing.Platform.
What do agents get wrong?
- No passwords or keys in
appsettings.json; usedotnet user-secretsin development. - With Central Package Management,
<PackageReference>has noVersion; set it inDirectory.Packages.props. global.jsonsdk.versiontakes a full version such as10.0.100, never10or10.0.x.dotnet testruns VSTest unlessglobal.jsonsets"test": { "runner": "Microsoft.Testing.Platform" }.
From the official docs: learn.microsoft.com/sdk (new tab) · learn.microsoft.com/selective-unit-tests (new tab) · learn.microsoft.com/dotnet-format (new tab) · learn.microsoft.com/app-secrets (new tab) · learn.microsoft.com/central-package-management (new tab) · learn.microsoft.com/global-json (new tab). The rest of the file is the same for any project: what goes in an AGENTS.md.
.NET repos with an AGENTS.md or CLAUDE.md (6)
Built on .NET; 6 pass the AGENTS.md check in full.
| Repo | File | Length | Stars | Language | Score |
|---|---|---|---|---|---|
| files-community/ | AGENTS.md | 22,904 chars | 46.8k ★ | C# | 71.5 |
| dotnet/ | AGENTS.md | 1,512 chars | 23.3k ★ | C# | 80.9 |
| bitwarden/ | .claude/CLAUDE.md | 3,130 chars | 20.7k ★ | C# | 80.9 |
| Sonarr/ | AGENTS.md | 2,777 chars | 17.8k ★ | C# | 80.0 |
| MudBlazor/ | AGENTS.md | 33,922 chars | 10.7k ★ | C# | 73.7 |
| OrchardCMS/ | AGENTS.md | 35,233 chars | 8.2k ★ | C# | 84.6 |
By language: C# AGENTS.md examples
More examples: Next.js · React · FastAPI · Flutter · Android · Rails · Vue · Laravel · Django · Angular · React Native · Spring Boot · iOS · all examples