dotnet-format(1)
π dotnet-format(1) π
the .NET Documentation girlies presentβ¦ the dotnet format glow-up β¨
This article applies to: βοΈ .NET 6 SDK and later versions
β¨ NAME β¨
dotnet-format β formats code to match editorconfig settings. that's it, that's the job, and it slays π
π SYNOPSIS π
dotnet format [<PROJECT | SOLUTION>]
[--binarylog <BINARY-LOG-PATH>] [--diagnostics <DIAGNOSTICS>]
[--exclude <EXCLUDE>] [--exclude-diagnostics <EXCLUDE-DIAGNOSTICS>]
[--include <INCLUDE>] [--include-generated]
[--no-restore] [--report <REPORT-PATH>] [--severity <LEVEL>]
[-v|--verbosity <LEVEL>] [--verify-no-changes] [--version]
dotnet format -h|--help
π¦ DESCRIPTION π¦
okay bestie, so dotnet format is a code formatter that takes your style preferences and your static analysis recommendations and applies them to a project or a solution. it's giving personal stylist but for your codebase π
Where do the preferences come from? From an .editorconfig file, if there is one present. And if there's not? No stress β a default set of preferences gets used instead. For more information, see the EditorConfig documentation. π
π ARGUMENTS π
PROJECT | SOLUTIONβ the MSBuild project or solution you wanna run code formatting on. and if you don't specify a project or solution file at all? MSBuild goes snooping around the current working directory for a file whose extension ends inprojorsln, and uses that one. lowkey it finds its own vibe π
π OPTIONS π
None of the options below are required for the dotnet format command to succeed β she works without them, fr fr. But you can use them to further customize what gets formatted and by which rules. main character customization energy β¨
--binarylog <BINARY-LOG-PATH>β logs all project or solution load information to a binary log file.--diagnostics <DIAGNOSTICS>β a space-separated list of diagnostic IDs to use as a filter when fixing code style or third-party issues. default value is whichever IDs are listed in the.editorconfigfile. for a list of built-in analyzer rule IDs that you can specify, see the list of IDs for code-analysis style rules.--exclude <EXCLUDE>β a space-separated list of relative file or folder paths to exclude from formatting. the default is none.--exclude-diagnostics <EXCLUDE-DIAGNOSTICS>β a space-separated list of diagnostic IDs to exclude when fixing code style or third-party issues. default value is none. for a list of built-in analyzer rule IDs that you can specify, see the list of IDs for code-analysis style rules.--include <INCLUDE>β a space-separated list of relative file or folder paths to include in formatting. the default is all files in the solution or project.--include-generatedβ formats files generated by the SDK.--no-restoreβ doesn't execute an implicit restore before formatting. default is to do implicit restore.--report <REPORT-PATH>β produces a JSON report in the directory specified by<REPORT_PATH>.--severity <LEVEL>β the minimum severity of diagnostics to fix. allowed values areinfo,warn, anderror. the default value iswarn.--verify-no-changesβ verifies that no formatting changes would be performed. terminates with a non zero exit code if any files would have been formatted. π she's checking your work, be brave--versionβ displays version information.-v|--verbosity <LEVEL>β sets the verbosity level of the command. allowed values areq[uiet],m[inimal],n[ormal],d[etailed], anddiag[nostic]. for more information, see<xref:Microsoft.Build.Framework.LoggerVerbosity>.-?|-h|--helpβ prints out a description of how to use the command.
πΈ SUBCOMMANDS πΈ
π§ Whitespace π§
dotnet format whitespace β Formats code to match editorconfig settings for whitespace.
DESCRIPTION
The dotnet format whitespace subcommand only runs formatting rules associated with whitespace formatting. for a complete list of possible formatting options that you can specify in your .editorconfig file, see the C# formatting options. π«§
OPTIONS
--folderβ treat the<PROJECT | SOLUTION>argument as a path to a simple folder of code files.
β Style β
dotnet format style β Formats code to match EditorConfig settings for code style.
DESCRIPTION
The dotnet format style subcommand only runs formatting rules associated with code style formatting. for a complete list of formatting options that you can specify in your editorconfig file, see Code style rules. π
OPTIONS
--diagnostics <DIAGNOSTICS>β a space-separated list of diagnostic IDs to use as a filter when fixing code style issues. default value is whichever IDs are listed in the.editorconfigfile. for a list of built-in code style analyzer rule IDs that you can specify, see the list of IDs for code-analysis style rules.--severity <LEVEL>β the minimum severity of diagnostics to fix. allowed values areinfo,warn, anderror. the default value iswarn
π₯ Analyzers π₯
dotnet format analyzers β Formats code to match editorconfig settings for analyzers (excluding code style rules).
DESCRIPTION
The dotnet format analyzers subcommand only runs formatting rules associated with analyzers. for a list of analyzer rules that you can specify in your editorconfig file, see Quality rules. π¬
OPTIONS
--diagnostics <DIAGNOSTICS>β a space-separated list of diagnostic IDs to use as a filter when fixing non code style issues. default value is whichever IDs are listed in the.editorconfigfile. for a list of built-in analyzer rule IDs that you can specify, see the list of IDs for quality rules. for third-party analyzers refer to their documentation.--severity <LEVEL>β the minimum severity of diagnostics to fix. allowed values areinfo,warn, anderror. the default value iswarn.
π EXAMPLES π
- Format all code in the solution:
dotnet format ./solution.sln
- Clean up all code in the application project:
dotnet format ./src/application.csproj
- Verify that all code is correctly formatted:
dotnet format --verify-no-changes
- Clean up all code in the
srcandtestsdirectory but not insrc/submodule-a:
dotnet format --include ./src/ ./tests/ --exclude ./src/submodule-a/
- Fix a specific code style issue:
dotnet format style --diagnostics IDE0005 --severity info
- Fix all code style issues that have severity
info,warningorerror:
dotnet format style --severity info
- Fix a specific (non code style) analyzer issue:
dotnet format analyzers --diagnostics CA1831 --severity warn
- Fix all non code style issues that have severity
info,warningorerror:
dotnet format analyzers --severity info
and that's the whole page, bestie!! β¨ this one's from the .NET Documentation, dated 2025-10-30, and yeah the manual name is literally dotnet-format(1) β go format something pretty, you got this πππ¦
π¦ where this page comes from
- alpine 3.24: dotnet-doc 10.0.303-r2 Β· MIT
- centos-stream 10: dotnet-host 11.0.0~rc.2.26504.105-0.10.el10 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- centos-stream 9: dotnet-host 11.0.0~rc.2.26504.105-0.11.el9 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 43: dotnet-host 10.0.12-1.fc43
- fedora 43: dotnet-host 11.0.0~rc.1.26425.128-0.10.fc43 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 10.0.12-1.fc44
- fedora 44: dotnet-host 10.0.4-1.fc44 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 11.0.0~rc.1.26425.128-0.12.fc44 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- nixpkgs unstable: dotnet-vmr 11.0.0-rc.3
- ubuntu noble: dotnet-host-10.0 10.0.12-0ubuntu1~24.04.1
- ubuntu questing: dotnet-host-10.0 10.0.9-0ubuntu1~25.10.1
- ubuntu resolute: dotnet-host-10.0 10.0.12-0ubuntu1~26.04.1
- ubuntu resolute: dotnet-host-10.0 10.0.5-0ubuntu1 Β· MIT
- ubuntu stonking: dotnet-host-10.0 10.0.12-0ubuntu2 Β· MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc1-0ubuntu1 Β· MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc3-0ubuntu1~26.10.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms