/dotnet-sort-refs

A .NET Core global tool to alphabetically sort package references in your .NET Core and .NET Standard projects.

Primary LanguageC#MIT LicenseMIT

dotnet-sort-refs

Build status NuGet Version

A .NET Core global tool to alphabetically sort package references in your .NET Core and .NET Standard projects.

If you have benefitted from this library and has saved you a bunch of time, please feel free to buy me a coffee!
GitHub Sponsor

Why use this tool?

References and package references in a project file are the most updated parts. Sorting the references helps with the following:

  • Easier merges on source control (git). Without sorting the package references in the project file, you may end up with more merge conflicts to fix.
  • It will be easier to go through the list of package references if you manually edit the file or view changes using a diff tool.

Installation

dotnet tool install --global dotnet-sort-refs

Usage

dotnet sort-refs [arguments] [options]

Arguments:
  Path          The path to a .csproj, .fsproj or directory. If a directory is specified, all .csproj and .fsproj files within folder tree will be processed. If none specified, it will use the current directory.

Options:
  --version     Show version information
  -?|-h|--help  Show help information
  -i|--inspect  Specifies whether to inspect and return a non-zero exit code if one or more projects have non-sorted package references.

Note: dotnet sort-refs and dotnet-sort-refs are valid usages to run the tool.