PetchNaka.CsProjFormatter.Tool 0.1.3

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet tool install --global PetchNaka.CsProjFormatter.Tool --version 0.1.3
                    
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 PetchNaka.CsProjFormatter.Tool --version 0.1.3
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=PetchNaka.CsProjFormatter.Tool&version=0.1.3
                    
nuke :add-package PetchNaka.CsProjFormatter.Tool --version 0.1.3
                    

CsProjFormatter

Formats SDK-style .csproj files after saving: sorts supported entries, normalizes XML formatting, and applies consistent spacing. Use only with a source control system and at your own risk. Targets Visual Studio 2022 and newer.

See the change log for changes and road map.


Download this extension from the Visual Studio Marketplace or get the CI build.

Build status

Settings

EditorConfig

Formatting rules are configured in the EditorConfig file as follows:

[*.csproj]
csproj_formatter_sort_entries=true
csproj_formatter_empty_lines_between_groups=1
indent_style=space
tab_width=4
end_of_line=crlf

When the EditorConfig Language Service version 1.18.35 or newer is installed, the CsProjFormatter VSIX contributes these properties to its IntelliSense and validation. Restart Visual Studio after installing or updating either extension so that the custom schema is loaded.

Sorting behavior:

  • PropertyGroup entries are sorted alphabetically, but dependencies like $(Version) are kept before the properties that reference them.
  • ItemGroup entries are sorted when all items are the same type: PackageReference, ProjectReference, Reference, or None.
  • PackageReference groups are ordered as: normal packages, IncludeAssets, PrivateAssets, and then Condition, with alphabetical sorting inside each group.
  • Top-level groups are separated by one empty line by default. Configure with csproj_formatter_empty_lines_between_groups (0 disables extra blank lines).

A few things can be configured and probably you want to have this done as follows:

Settings

Use the experimental setting with caution since it may have undesired side effects.

Agent Skill / CLI

Download csprojfmt-<version>.zip from an AppVeyor build and extract its csprojfmt directory into your Codex skills directory. The skill includes .NET 10 framework-dependent single-file executables for Windows x64 and Linux x64.

The packaged executables are not digitally signed.

Invoke the agent skill with:

Use $csprojfmt to check and format the .csproj files in this repository.

Or call the packaged executable directly from the directory containing the project files you want to process.

Windows:

& "$env:USERPROFILE\.codex\skills\csprojfmt\assets\cli\win-x64\csprojfmt.exe" --check --recursive .

Linux:

chmod u+x "$HOME/.codex/skills/csprojfmt/assets/cli/linux-x64/csprojfmt"
"$HOME/.codex/skills/csprojfmt/assets/cli/linux-x64/csprojfmt" --check --recursive .

The command syntax is csprojfmt [options] [<path> ...]. Use --check to detect required changes without writing, --dry-run to preview, --recursive to include subdirectories, and --verbose for detailed output. Formatting follows the applicable EditorConfig settings; without a path, the current directory is processed.

The CLI reports updated, would-update, unchanged, skipped, or failed for each file. A skipped file either has no applicable formatting settings or is not an SDK-style project. Exit code 1 means --check found pending changes; exit code 2 means a usage, path, access, or formatting failure.

Contributing

Please use the issue tracker for submitting bug reports or feature requests.

License

MIT License

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