organize-csproj
1.1.3
See the version list below for details.
dotnet tool install --global organize-csproj --version 1.1.3
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local organize-csproj --version 1.1.3
#tool dotnet:?package=organize-csproj&version=1.1.3
nuke :add-package organize-csproj --version 1.1.3
Usage
Install as a global dotnet tool.
dotnet tool install -g organize-csproj
Then, use it via:
organize-csproj --input=your-project.csproj
CLI Arguments
--input
Description: The path to a .csproj
file.
Default: None
Required: Yes
--output
Description: The filename to save the input.csproj
after it has been sorted.
Default: The value of --input
(overwrites existing file)
Required: No
--config
Description: The path to a configuration json file
Default: None
Required: No
Example
dotnet organize-csproj --input=project.csproj --output=project.sorted.csproj --config=my.config.json
Configuration
The default configuration can be seen here: csproj.config.defaults.json It should work as a solid reference to get yourself started. The configuration needs to map to SortConfiguration.cs.
If this isn't sufficient documentation, open an issue and I'll write out more.
Sort Options
Below are the primary steps taken when cleaning up a .csproj
file.
They each can be disabled using your own configuration file, like so:
{
"SortOptions": {
"GroupByNodeType": true,
"GroupByFileType": true,
"RemoveEmptyItemGroups": true,
"SortItemsWithinItemGroups": true
}
}
They all default to true
.
GroupByNodeType
Groups all
Item
s of the same type into their own<ItemGroup>
(e.g.,
<Content>
,<Compile>
,<TypeScriptCompile>
, etc)
GroupByFileType
- Creates
<ItemGroup>
s for each distinct filetype - Subdivides existing
<ItemGroup>
s into even more granular<ItemGroup>
s
- Creates
RemoveEmptyItemGroups
- Removes
<ItemGroup>
s without any children. The tool doesn't create empty<ItemGroup>
s―this option is for tidying up.
- Removes
SortItemsWithinItemGroups
- Whether to alphanum sort all
<ItemGroup>
s. Performed last.
- Whether to alphanum sort all
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
This package has no dependencies.