Dotnet/C# repository tools
Updates all the packages specified in the packages.json file in the repositories in repos.txt.
release.jsondefines the configuration for generating releases when multiple packages have been updated- the template repo specified by
--templateis excluded fromrepos.txtif it is present
dotnet updaterepo \
update-packages \
--repositories ~/work/personal/auto-update-config/personal/repos.lst \
--work ~/temp \
--tracking ~/temp/tracking.json \
--cache ~/temp/cache.json \
--packages ~/work/personal/auto-update-config/packages.json \
--template git@github.com:credfeto/cs-template.git \
--release ~/work/personal/auto-update-config/release.jsonUpdates common files in a repository to match the files defined template repository specified by --template.
dotnet updaterepo \
update-template \
--repositories ~/work/personal/auto-update-config/personal/repos.lst \
--work ~/temp \
--tracking ~/temp/tracking.json \
--packages ~/work/personal/auto-update-config/packages.json \
--template git@github.com:credfeto/cs-template.git \
--release ~/work/personal/auto-update-config/release.jsonTODO - this is not yet implemented
dotnet updaterepo \
code-cleanup \
--repositories ~/work/personal/auto-update-config/personal/repos.lst \
--work ~/temp \
--tracking ~/temp/tracking.jsoncscleanup is a standalone dotnet tool that formats C# source files (.cs) and project files (.csproj) without requiring a git repository or making any commits. It is suitable for use as a pre-commit hook or in CI pipelines.
dotnet tool install --global Credfeto.DotNet.Repo.Formattercscleanup [--remove-suppressions] [--build-root <path>] <inputs...>
| Argument / Option | Required | Description |
|---|---|---|
inputs |
Yes | One or more files, glob patterns, or folders to process |
--remove-suppressions |
No | Remove redundant [SuppressMessage] attributes (requires --build-root) |
--build-root <path> |
Conditional | Root directory used for dotnet build when --remove-suppressions is enabled |
- File path — processed directly; must be a
.csor.csprojfile - Glob pattern — expanded relative to the current working directory (e.g.
"src/**/*.cs") - Directory — scanned recursively for all
.csand.csprojfiles, excluding generated files (paths containing/obj/,/generated/, or.generated.in the filename)
Passing any other file type is an error.
Format a single file:
cscleanup src/MyProject/Foo.csFormat all C# files in a folder:
cscleanup src/MyProject/Format files matching a glob:
cscleanup "src/**/*.cs"Format multiple inputs at once:
cscleanup src/MyProject/ src/MyProject.Tests/Remove suppression attributes (requires a successful build to verify each removal is safe):
cscleanup --remove-suppressions --build-root /path/to/solution src/MyProject/For each .cs file:
- Converts Resharper suppression comments to
[SuppressMessage]attributes - Removes XML doc comments
- Reformats the file using CSharpier
- Optionally removes redundant
[SuppressMessage]attributes (only when--remove-suppressionsand--build-rootare set)
For each .csproj file:
- Reorders
<PropertyGroup>elements into a canonical order - Reorders
<ItemGroup>includes into a canonical order
Add to .git/hooks/pre-commit (or via a hook manager such as pre-commit):
#!/bin/sh
git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cs|csproj)$' | xargs cscleanupOne line per repo to process e.g:
git@github.com:credfeto/repo1.git
git@github.com:credfeto/repo2.git
git@github.com:credfeto/repo3.git
This is generated by the tool
This is generated by the tool
TODOTODOThe update-template command generates two GitHub configuration files for each managed repository:
labels.yml— defines all labels (name, colour, description) used in the repositorylabeler.yml— maps file path patterns to labels so pull requests are labelled automatically
These labels are applied to every managed repository regardless of content:
| Label | Colour | Description |
|---|---|---|
.NET update |
a870c9 |
Update to .NET SDK version in global.json |
AI-Work |
ffa500 |
Work for an AI Agent |
auto-pr |
0000aa |
Pull request created automatically |
Bug |
d73a4a |
Generic bug fix |
C# |
db6baa |
C# source files |
C# Project |
db6baa |
C# project files (.csproj) |
C# Solution |
db6baa |
C# solution files (.sln / .slnx) |
Change Log |
53fcd4 |
Changelog tracking file |
Changelog Not Required |
08f5f8 |
No changelog entry required for this pull request |
Config Change |
d8bb50 |
Configuration file changes |
dependencies |
0366d6 |
Updates to dependencies |
DO NOT MERGE |
ff0000 |
This pull request should not be merged yet |
dotnet |
db6baa |
.NET package updates |
Editorconfig |
00dead |
Editor config file change |
Enhancement |
a2eeef |
Enhancement to project |
github-actions |
e09cf4 |
GitHub Actions workflow files |
High |
ffa500 |
High priority |
Low |
cc8899 |
Low priority |
Markdown |
5319e7 |
Markdown files |
Medium |
ffff00 |
Medium priority |
Migration Script |
b680e5 |
SQL migration scripts |
no-pr-activity |
ffff00 |
Pull request has had no activity for a long time |
npm |
e99695 |
npm package update |
On Hold |
ff0000 |
Do not work on this |
Performance |
0075ca |
Performance enhancement or issue |
Powershell |
23bc12 |
PowerShell source files |
Read Me |
5319e7 |
Repository readme file |
Security |
ee0701 |
Security issue, e.g. use of insecure packages, or security fix |
Setup |
5319e7 |
Setup instructions |
Solidity |
413cd1 |
Solidity source files |
SQL |
413cd1 |
SQL source files |
Static Code Analysis Rules |
00dead |
Static code analysis ruleset files |
Tech Debt |
30027a |
Technical debt |
Unit Tests |
0e8a16 |
Unit test and integration test projects |
Urgent |
ff0000 |
Urgent priority |
For each .csproj found in the repository, a label is created named after the project (dots and spaces replaced with hyphens, lowercased). The colour indicates the project type:
| Pattern | Colour | Meaning |
|---|---|---|
*.Tests / *.Tests.* |
0e8a16 |
Test project |
*.Mocks |
0e8a16 |
Mock/test-helper project |
| Everything else | 96f7d2 |
Production source project |
| Branch | Status |
|---|---|
| main | |
| release |
View changelog