dotnet-sort
1.0.5
dotnet tool install --global dotnet-sort --version 1.0.5
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local dotnet-sort --version 1.0.5
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-sort&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package dotnet-sort --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
dotnet-sort
A global .NET Core tool for ordering alphabetically, length, the references of packages or imports in your .NET Core and .NET Standard projects.
Installation
dotnet tool install --global dotnet-sort
Usage
Usage:
dotnet-sort [options]
Options:
-h, --help Show command line help.
-p, --path Path where found the *.csproj or *.cs files (defaults to the current directory)
-a <APPLY> Apply to references or imports.
Examples:
Sorting references and imports on *.cs (default): -a=ri
Sorting only references on *.csproj: -a=r
Sorting only imports on *.cs: -a=i
-s <MODE> Sort by length/alphabetically
Examples:
alphabetically ascending (default): -s=a
alphabetically descendently: -s=ad
length ascending: -s=l
length descendently: -s=ld
Examples
Command to sort references -a=r
alphabetically ascending -s=a
dotnet-sort --path=Project.csproj -a=r -s=a
Project.csproj
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Grpc" Version="1.19.0" />
<PackageReference Include="Google.Protobuf" Version="3.7.0" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.7.0" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.7.0" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.7.0" />
<PackageReference Include="Grpc" Version="1.19.0" />
</ItemGroup>
</Project>
Command to sort imports -a=i
by length descendently -s=ld
dotnet-sort --path=Code.cs -a=i -s=ld
Code.cs
using System.Text.RegularExpressions;
using System.Linq;
using System;
using System.IO;
using System.Text;
using System.Xml.XPath;
using System.Text.RegularExpressions;
using System.Xml.XPath;
using System.Text;
using System.Linq;
using System.IO;
using System;
Command to sort imports -a=i
by length ascending -s=la
dotnet-sort --path=Code.cs -a=i -s=ld
Code.cs
using System.Text.RegularExpressions;
using System.Linq;
using System;
using System.IO;
using System.Text;
using System.Xml.XPath;
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Xml.XPath;
using System.Text.RegularExpressions;
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.