{"id":18280013,"url":"https://github.com/lordmike/mbw.tools.csprojformatter","last_synced_at":"2025-04-09T04:49:26.022Z","repository":{"id":42208313,"uuid":"208632087","full_name":"LordMike/MBW.Tools.CsProjFormatter","owner":"LordMike","description":"Dotnet global tool to format CSProj files, sorting dependencies and indenting elements","archived":false,"fork":false,"pushed_at":"2023-09-19T21:15:02.000Z","size":43,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T17:10:36.667Z","etag":null,"topics":["csproj","formatter"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LordMike.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-15T17:41:22.000Z","updated_at":"2023-12-10T01:07:45.000Z","dependencies_parsed_at":"2024-11-05T12:32:19.366Z","dependency_job_id":null,"html_url":"https://github.com/LordMike/MBW.Tools.CsProjFormatter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordMike%2FMBW.Tools.CsProjFormatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordMike%2FMBW.Tools.CsProjFormatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordMike%2FMBW.Tools.CsProjFormatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordMike%2FMBW.Tools.CsProjFormatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LordMike","download_url":"https://codeload.github.com/LordMike/MBW.Tools.CsProjFormatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980820,"owners_count":21027803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csproj","formatter"],"created_at":"2024-11-05T12:32:12.408Z","updated_at":"2025-04-09T04:49:26.005Z","avatar_url":"https://github.com/LordMike.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MBW.Tools.CsProjFormatter [![Generic Build](https://github.com/LordMike/MBW.Tools.CsProjFormatter/actions/workflows/dotnet.yml/badge.svg)](https://github.com/LordMike/MBW.Tools.CsProjFormatter/actions/workflows/dotnet.yml) [![NuGet](https://img.shields.io/nuget/v/MBW.Tools.CsProjFormatter.svg)](https://www.nuget.org/packages/MBW.Tools.CsProjFormatter) [![GHPackages](https://img.shields.io/badge/package-alpha-green)](https://github.com/LordMike/MBW.Tools.CsProjFormatter/packages/703133)\r\n\r\nDotnet tool to format `.csproj` files. \r\n\r\n## Installation\r\n\r\nRun `dotnet tool install -g MBW.Tools.CsProjFormatter`. After this, `csproj-format` should be in your PATH.\r\n\r\n## Usage\r\n\r\nRun `csproj-format \u003cdir\u003e` to recursively format all `.csproj` and `.targets` files in that directory. Multiple directories can be specified. The help page (`--help`) details more options that can be set, f.ex. dry-run (`-n`) or including/excluding more file types (`--include` and `--exclude`).\r\n\r\n## Configuration\r\n\r\nThe formatter reads all appropriate `.editorconfig` files as specified by that standard (reading all parent editor configs etc.). Configure the options for `.csproj` and `.targets` as appropriate.\r\n\r\n### Options\r\n\r\n#### indent_style and indent_size\r\n\r\nThe formatter respects the `indent_style` and `indent_size` options. If specified, indentation of all formatted files will be as specified. \r\n\r\nThese are part of the [\"default\" options](https://editorconfig-specification.readthedocs.io/en/latest/#supported-properties).\r\n\r\n#### end_of_line\r\n\r\nThe formatter respects the `end_of_line` option. If specified, all line endings will be converted to match the specified value. Supported values: `cr`, `lf`, `crlf`\r\n\r\nThis is part of the [\"default\" options](https://editorconfig-specification.readthedocs.io/en/latest/#supported-properties).\r\n\r\n#### charset\r\n\r\nThe formatter respects the `charset` option. If specified, all files will be rewritten in the specified encoding. Supported values: `latin1`, `utf-16be`, `utf-16le`, `utf-8`, `utf-8-bom`.\r\n\r\nThis is part of the [\"default\" options](https://editorconfig-specification.readthedocs.io/en/latest/#supported-properties).\r\n\r\n#### insert_final_newline\r\n\r\nThe formatter respects the `insert_final_newline` option. If specified, all files will include a trailing empty line.\r\n\r\nThis is part of the [\"default\" options](https://editorconfig-specification.readthedocs.io/en/latest/#supported-properties).\r\n\r\n\r\n#### csproj_prefer_package_reference_attributes\r\n\r\nIf `csproj_prefer_package_reference_attributes` is specified to `true`, the formatter will convert all \"verbose\" package references to more compact ones. \r\n\r\nExample:\r\n```xml\r\n\u003cPackageReference\u003e\r\n  \u003cInclude\u003eMy.Package\u003c/Include\u003e\r\n  \u003cVersion\u003e3.1.1\u003c/Version\u003e\r\n\u003cPackageReference\u003e\r\n```\r\n\r\nBecomes:\r\n\r\n```xml\r\n\u003cPackageReference Include=\"My.Package\" Version=\"3.1.1\" /\u003e\r\n```\r\n\r\n#### csproj_sort_package_project_references\r\n\r\nIf `csproj_sort_package_project_references` is specified to `true`, the formatter will sort all ItemGroups that include ONLY `PackageReference` and `ProjectReference` statements. \r\n\r\nExample:\r\n```xml\r\n  \u003cItemGroup\u003e\r\n    \u003cPackageReference Include=\"Microsoft.Extensions.DependencyInjection\" Version=\"2.2.0\" /\u003e\r\n    \u003cPackageReference Include=\"Serilog.Sinks.Console\" Version=\"3.1.1\" /\u003e\r\n    \u003cPackageReference Include=\"McMaster.Extensions.CommandLineUtils\" Version=\"2.3.4\" /\u003e\r\n    \u003cPackageReference Include=\"Serilog.Extensions.Logging\" Version=\"2.0.4\" /\u003e\r\n    \u003cPackageReference Include=\"Microsoft.Extensions.FileSystemGlobbing\" Version=\"2.2.0\" /\u003e\r\n  \u003c/ItemGroup\u003e\r\n```\r\n\r\nBecomes:\r\n\r\n```xml\r\n  \u003cItemGroup\u003e\r\n    \u003cPackageReference Include=\"McMaster.Extensions.CommandLineUtils\" Version=\"2.3.4\" /\u003e\r\n    \u003cPackageReference Include=\"Microsoft.Extensions.DependencyInjection\" Version=\"2.2.0\" /\u003e\r\n    \u003cPackageReference Include=\"Microsoft.Extensions.FileSystemGlobbing\" Version=\"2.2.0\" /\u003e\r\n    \u003cPackageReference Include=\"Serilog.Extensions.Logging\" Version=\"2.0.4\" /\u003e\r\n    \u003cPackageReference Include=\"Serilog.Sinks.Console\" Version=\"3.1.1\" /\u003e\r\n  \u003c/ItemGroup\u003e\r\n```\r\n\r\n#### csproj_split_top_level_elements\r\n\r\nIf `csproj_split_top_level_elements` is specified to `true`, the formatter will split all top-level declarations by one empty line.\r\n\r\n```xml\r\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\r\n  \u003cPropertyGroup\u003e\r\n    \u003cTargetFramework\u003enetcoreapp2.2\u003c/TargetFramework\u003e\r\n    \u003cVersion\u003e0.1.0\u003c/Version\u003e\r\n  \u003c/PropertyGroup\u003e\r\n  \u003cItemGroup\u003e\r\n    \u003cPackageReference Include=\"My.Package\" Version=\"1.2.3.4\" /\u003e\r\n  \u003c/ItemGroup\u003e\r\n\u003c/Project\u003e\r\n```\r\n\r\n```xml\r\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\r\n\r\n  \u003cPropertyGroup\u003e\r\n    \u003cTargetFramework\u003enetcoreapp2.2\u003c/TargetFramework\u003e\r\n    \u003cVersion\u003e0.1.0\u003c/Version\u003e\r\n  \u003c/PropertyGroup\u003e\r\n\r\n  \u003cItemGroup\u003e\r\n    \u003cPackageReference Include=\"My.Package\" Version=\"1.2.3.4\" /\u003e\r\n  \u003c/ItemGroup\u003e\r\n\r\n\u003c/Project\u003e\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordmike%2Fmbw.tools.csprojformatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flordmike%2Fmbw.tools.csprojformatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flordmike%2Fmbw.tools.csprojformatter/lists"}