Skip to content

Commit a3bb2af

Browse files
Refresh dotnet command reference (#48787)
* refresh dotnet command reference to use latest commands and .NET 6 and later versions * Update dotnet format documentation for clarity and accuracy * update options list format * reduce spacing for command options list * Specify .NET 6 SDK as minimum version and update options * Clarify .NET version applicability and update command options in dotnet publish documentation * Update docs/core/tools/dotnet-dev-certs.md Co-authored-by: Genevieve Warren <[email protected]> * Update docs/core/tools/dotnet-restore.md Co-authored-by: Genevieve Warren <[email protected]> * Update docs/core/tools/dotnet-run.md Co-authored-by: Genevieve Warren <[email protected]> * Update dotnet format to clarify severity option usage * Update description for self-contained and -no-self-contained options * Refactor command options to use include files for self-contained and runtime settings --------- Co-authored-by: Genevieve Warren <[email protected]>
1 parent fdcbe5e commit a3bb2af

17 files changed

+239
-171
lines changed

docs/core/tools/dotnet-build.md

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.date: 09/24/2025
55
---
66
# dotnet build
77

8-
**This article applies to:** ✔️ .NET 6 and later versions
8+
**This article applies to:** ✔️ .NET 6 SDK and later versions
99

1010
## Name
1111

@@ -16,15 +16,13 @@ ms.date: 09/24/2025
1616
```dotnetcli
1717
dotnet build [<PROJECT>|<SOLUTION>|<FILE>] [-a|--arch <ARCHITECTURE>]
1818
[--artifacts-path <ARTIFACTS_DIR>]
19-
[-c|--configuration <CONFIGURATION>] [-f|--framework <FRAMEWORK>]
20-
[--disable-build-servers]
21-
[--force] [--interactive] [--no-dependencies] [--no-incremental]
22-
[--no-restore] [--nologo] [--no-self-contained] [--os <OS>]
23-
[-o|--output <OUTPUT_DIRECTORY>]
24-
[-p|--property:<PROPERTYNAME>=<VALUE>]
25-
[-r|--runtime <RUNTIME_IDENTIFIER>]
26-
[-sc|--self-contained [true|false]] [--source <SOURCE>]
27-
[--tl:[auto|on|off]] [--use-current-runtime, --ucr [true|false]]
19+
[-c|--configuration <CONFIGURATION>] [--disable-build-servers]
20+
[-f|--framework <FRAMEWORK>] [--force] [--interactive]
21+
[--no-dependencies] [--no-incremental] [--no-restore] [--nologo]
22+
[--no-self-contained] [-o|--output <OUTPUT_DIRECTORY>] [--os <OS>]
23+
[-p|--property:<PROPERTYNAME>=<VALUE>] [-r|--runtime <RUNTIME_IDENTIFIER>]
24+
[--sc|--self-contained] [--source <SOURCE>]
25+
[--tl:[auto|on|off]] [ --ucr|--use-current-runtime]
2826
[-v|--verbosity <LEVEL>] [--version-suffix <VERSION_SUFFIX>]
2927
3028
dotnet build -h|--help
@@ -95,8 +93,6 @@ Running `dotnet build` is equivalent to running `dotnet msbuild -restore`; howev
9593

9694
Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the *project.assets.json* file.
9795

98-
[!INCLUDE [help](../../../includes/cli-help.md)]
99-
10096
[!INCLUDE [interactive](../../../includes/cli-interactive-3-0.md)]
10197

10298
- **`--no-dependencies`**
@@ -115,9 +111,7 @@ Running `dotnet build` is equivalent to running `dotnet msbuild -restore`; howev
115111

116112
Doesn't display the startup banner or the copyright message.
117113

118-
- **`--no-self-contained`**
119-
120-
Publishes the application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run the application. Available since .NET 6 SDK.
114+
[!INCLUDE [no-self-contained](../../../includes/cli-no-self-contained.md)]
121115

122116
- **`-o|--output <OUTPUT_DIRECTORY>`**
123117

@@ -142,28 +136,24 @@ Running `dotnet build` is equivalent to running `dotnet msbuild -restore`; howev
142136

143137
Specifies the target runtime. For a list of Runtime Identifiers (RIDs), see the [RID catalog](../rid-catalog.md). If you use this option with .NET 6 SDK, use `--self-contained` or `--no-self-contained` also. If not specified, the default is to build for the current OS and architecture.
144138

145-
- **`--self-contained [true|false]`**
146-
147-
Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is `true` if a runtime identifier is specified. Available since .NET 6.
139+
[!INCLUDE [self-contained](../../../includes/cli-self-contained.md)]
148140

149141
- **`--source <SOURCE>`**
150142

151143
The URI of the NuGet package source to use during the restore operation.
152144

153145
[!INCLUDE [tl](../../../includes/cli-tl.md)]
154146

155-
- **`-v|--verbosity <LEVEL>`**
147+
[!INCLUDE [use-current-runtime](../../../includes/cli-use-current-runtime.md)]
156148

157-
Sets the verbosity level of the command. Allowed values are `q[uiet]`, `m[inimal]`, `n[ormal]`, `d[etailed]`, and `diag[nostic]`. The default is `minimal`. By default, MSBuild displays warnings and errors at all verbosity levels. To exclude warnings, use `/property:WarningLevel=0`. For more information, see <xref:Microsoft.Build.Framework.LoggerVerbosity> and [WarningLevel](../../csharp/language-reference/compiler-options/errors-warnings.md#warninglevel).
158-
159-
- **`--use-current-runtime, --ucr [true|false]`**
160-
161-
Sets the `RuntimeIdentifier` to a platform portable `RuntimeIdentifier` based on the one of your machine. This happens implicitly with properties that require a `RuntimeIdentifier`, such as `SelfContained`, `PublishAot`, `PublishSelfContained`, `PublishSingleFile`, and `PublishReadyToRun`. If the property is set to false, that implicit resolution will no longer occur.
149+
[!INCLUDE [verbosity](../../../includes/cli-verbosity.md)]
162150

163151
- **`--version-suffix <VERSION_SUFFIX>`**
164152

165153
Sets the value of the `$(VersionSuffix)` property to use when building the project. This only works if the `$(Version)` property isn't set. Then, `$(Version)` is set to the `$(VersionPrefix)` combined with the `$(VersionSuffix)`, separated by a dash.
166154

155+
[!INCLUDE [help](../../../includes/cli-help.md)]
156+
167157
## Examples
168158

169159
- Build a project and its dependencies:

docs/core/tools/dotnet-clean.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.date: 09/24/2025
55
---
66
# dotnet clean
77

8-
**This article applies to:** ✔️ .NET 6 and later versions
8+
**This article applies to:** ✔️ .NET 6 SDK and later versions
99

1010
## Name
1111

docs/core/tools/dotnet-dev-certs.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: dotnet dev-certs command
33
description: The dotnet dev-certs command generates a self-signed certificate to enable HTTPS use in development.
4-
ms.date: 07/14/2022
4+
ms.date: 09/29/2025
55
---
66
# dotnet dev-certs
77

8-
**This article applies to:** ✔️ .NET Core 3.1 SDK and later versions
8+
**This article applies to:** ✔️ .NET 6 SDK and later versions
99

1010
## Name
1111

@@ -15,7 +15,8 @@ ms.date: 07/14/2022
1515

1616
```dotnetcli
1717
dotnet dev-certs https
18-
[-c|--check] [--clean] [-ep|--export-path <PATH>]
18+
[-c|--check] [--check-trust-machine-readable]
19+
[--clean] [-ep|--export-path <PATH>]
1920
[--format] [-i|--import] [-np|--no-password]
2021
[-p|--password] [-q|--quiet] [-t|--trust]
2122
[-v|--verbose] [--version]
@@ -61,6 +62,10 @@ The `dotnet dev-certs` command manages a self-signed certificate to enable HTTPS
6162

6263
Checks for the existence of the development certificate but doesn't perform any action. Use this option with the `--trust` option to check if the certificate is not only valid but also trusted.
6364

65+
- **`--check-trust-machine-readable`**
66+
67+
Same as running `--check --trust`, but outputs the results in JSON.
68+
6469
- **`--clean`**
6570

6671
Removes all HTTPS development certificates from the certificate store by using the .NET certificate store API. Doesn't remove any physical files that were created by using the `--export-path` option. On macOS in .NET 7.0, the `dotnet dev-certs` command creates the certificate on a path on disk, and the clean operation removes that certificate file.
@@ -188,8 +193,8 @@ The `dotnet dev-certs` command manages a self-signed certificate to enable HTTPS
188193

189194
## See also
190195

191-
* [Generate self-signed certificates with the .NET CLI](../additional-tools/self-signed-certificates-guide.md)
192-
* [Enforce HTTPS in ASP.NET Core](/aspnet/core/security/enforcing-ssl)
193-
* [Troubleshoot certificate problems such as certificate not trusted](/aspnet/core/security/enforcing-ssl#troubleshoot-certificate-problems-such-as-certificate-not-trusted)
194-
* [Hosting ASP.NET Core images with Docker over HTTPS](/aspnet/core/security/docker-https)
195-
* [Hosting ASP.NET Core images with Docker Compose over HTTPS](/aspnet/core/security/docker-compose-https)
196+
- [Generate self-signed certificates with the .NET CLI](../additional-tools/self-signed-certificates-guide.md)
197+
- [Enforce HTTPS in ASP.NET Core](/aspnet/core/security/enforcing-ssl)
198+
- [Troubleshoot certificate problems such as certificate not trusted](/aspnet/core/security/enforcing-ssl#troubleshoot-certificate-problems-such-as-certificate-not-trusted)
199+
- [Hosting ASP.NET Core images with Docker over HTTPS](/aspnet/core/security/docker-https)
200+
- [Hosting ASP.NET Core images with Docker Compose over HTTPS](/aspnet/core/security/docker-compose-https)

docs/core/tools/dotnet-format.md

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: dotnet format command
33
description: The dotnet format command formats code to match EditorConfig settings for the current directory.
4-
ms.date: 07/12/2021
4+
ms.date: 09/29/2025
55
---
66
# dotnet format
77

8-
**This article applies to:** ✔️ .NET 6.x SDK and later versions
8+
**This article applies to:** ✔️ .NET 6 SDK and later versions
99

1010
## Name
1111

@@ -14,7 +14,12 @@ ms.date: 07/12/2021
1414
## Synopsis
1515

1616
```dotnetcli
17-
dotnet format [<PROJECT | SOLUTION>] [command] [options]
17+
dotnet format [<PROJECT | SOLUTION>]
18+
[--binarylog <BINARY-LOG-PATH>] [--diagnostics <DIAGNOSTICS>]
19+
[--exclude <EXCLUDE>] [--exclude-diagnostics <EXCLUDE-DIAGNOSTICS>]
20+
[--include <INCLUDE>] [--include-generated]
21+
[--no-restore] [--report <REPORT-PATH>] [--severity <LEVEL>]
22+
[-v|--verbosity <LEVEL>] [--verify-no-changes] [--version]
1823
1924
dotnet format -h|--help
2025
```
@@ -33,49 +38,53 @@ The MSBuild project or solution to run code formatting on. If a project or solut
3338

3439
None of the options below are required for the `dotnet format` command to succeed, but you can use them to further customize what is formatted and by which rules.
3540

36-
* **`--diagnostics <DIAGNOSTICS>`**
41+
- **`--binarylog <BINARY-LOG-PATH>`**
3742

38-
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 *.editorconfig* file. For a list of built-in analyzer rule IDs that you can specify, see the [list of IDs for code-analysis style rules](../../fundamentals/code-analysis/style-rules/index.md).
43+
Logs all project or solution load information to a binary log file.
3944

40-
* **`--severity`**
45+
- **`--diagnostics <DIAGNOSTICS>`**
4146

42-
The minimum severity of diagnostics to fix. Allowed values are `info`, `warn`, and `error`. The default value is `warn`.
47+
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 *.editorconfig* file. For a list of built-in analyzer rule IDs that you can specify, see the [list of IDs for code-analysis style rules](../../fundamentals/code-analysis/style-rules/index.md).
4348

44-
* **`--no-restore`**
49+
- **`--exclude <EXCLUDE>`**
4550

46-
Doesn't execute an implicit restore before formatting. Default is to do implicit restore.
51+
A space-separated list of relative file or folder paths to exclude from formatting. The default is none.
4752

48-
* **`--verify-no-changes`**
53+
- **`--exclude-diagnostics <EXCLUDE-DIAGNOSTICS>`**
4954

50-
Verifies that no formatting changes would be performed. Terminates with a non zero exit code if any files would have been formatted.
55+
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](../../fundamentals/code-analysis/style-rules/index.md).
5156

52-
* **`--include <INCLUDE>`**
57+
- **`--include <INCLUDE>`**
5358

5459
A space-separated list of relative file or folder paths to include in formatting. The default is all files in the solution or project.
5560

56-
* **`--exclude <EXCLUDE>`**
61+
- **`--include-generated`**
5762

58-
A space-separated list of relative file or folder paths to exclude from formatting. The default is none.
63+
Formats files generated by the SDK.
5964

60-
* **`--include-generated`**
65+
- **`--no-restore`**
6166

62-
Formats files generated by the SDK.
67+
Doesn't execute an implicit restore before formatting. Default is to do implicit restore.
6368

64-
* **`-v|--verbosity <LEVEL>`**
69+
- **`--report <REPORT-PATH>`**
6570

66-
Sets the verbosity level. Allowed values are `q[uiet]`, `m[inimal]`, `n[ormal]`, `d[etailed]`, and `diag[nostic]`. Default value is `m[inimal]`.
71+
Produces a JSON report in the directory specified by `<REPORT_PATH>`.
6772

68-
* **`--binarylog <BINARY-LOG-PATH>`**
73+
- **`--severity <LEVEL>`**
6974

70-
Logs all project or solution load information to a binary log file.
75+
The minimum severity of diagnostics to fix. Allowed values are `info`, `warn`, and `error`. The default value is `warn`.
7176

72-
* **`--report <REPORT-PATH>`**
77+
- **`--verify-no-changes`**
7378

74-
Produces a JSON report in the directory specified by `<REPORT_PATH>`.
79+
Verifies that no formatting changes would be performed. Terminates with a non zero exit code if any files would have been formatted.
80+
81+
- **`--version`**
82+
83+
Displays version information.
7584

76-
* **`-h|--help`**
85+
[!INCLUDE [verbosity](../../../includes/cli-verbosity.md)]
7786

78-
Shows help and usage information
87+
[!INCLUDE [help](../../../includes/cli-help.md)]
7988

8089
## Subcommands
8190

@@ -89,7 +98,7 @@ The `dotnet format whitespace` subcommand only runs formatting rules associated
8998

9099
#### Options
91100

92-
* **`--folder`**
101+
- **`--folder`**
93102

94103
Treat the `<PROJECT | SOLUTION>` argument as a path to a simple folder of code files.
95104

@@ -103,11 +112,11 @@ The `dotnet format style` subcommand only runs formatting rules associated with
103112

104113
#### Options
105114

106-
* **`--diagnostics <DIAGNOSTICS>`**
115+
- **`--diagnostics <DIAGNOSTICS>`**
107116

108117
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 *.editorconfig* file. 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](../../fundamentals/code-analysis/style-rules/index.md).
109118

110-
* **`--severity`**
119+
- **`--severity <LEVEL>`**
111120

112121
The minimum severity of diagnostics to fix. Allowed values are `info`, `warn`, and `error`. The default value is `warn`
113122

@@ -121,59 +130,59 @@ The `dotnet format analyzers` subcommand only runs formatting rules associated w
121130

122131
##### Options
123132

124-
* **`--diagnostics <DIAGNOSTICS>`**
133+
- **`--diagnostics <DIAGNOSTICS>`**
125134

126135
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 *.editorconfig* file. For a list of built-in analyzer rule IDs that you can specify, see the [list of IDs for quality rules](../../fundamentals/code-analysis/quality-rules/index.md). For third-party analyzers refer to their documentation.
127136

128-
* **`--severity`**
137+
- **`--severity <LEVEL>`**
129138

130139
The minimum severity of diagnostics to fix. Allowed values are `info`, `warn`, and `error`. The default value is `warn`.
131140

132141
## Examples
133142

134-
* Format all code in the solution:
143+
- Format all code in the solution:
135144

136145
```dotnetcli
137146
dotnet format ./solution.sln
138147
```
139148

140-
* Clean up all code in the application project:
149+
- Clean up all code in the application project:
141150

142151
```dotnetcli
143152
dotnet format ./src/application.csproj
144153
```
145154

146-
* Verify that all code is correctly formatted:
155+
- Verify that all code is correctly formatted:
147156

148157
```dotnetcli
149158
dotnet format --verify-no-changes
150159
```
151160

152-
* Clean up all code in the *src* and *tests* directory but not in *src/submodule-a*:
161+
- Clean up all code in the *src* and *tests* directory but not in *src/submodule-a*:
153162

154163
```dotnetcli
155164
dotnet format --include ./src/ ./tests/ --exclude ./src/submodule-a/
156165
```
157166

158-
* Fix a specific **code style** issue:
167+
- Fix a specific **code style** issue:
159168

160169
```dotnetcli
161170
dotnet format style --diagnostics IDE0005 --severity info
162171
```
163172

164-
* Fix all **code style** issues that have severity `info`, `warning` or `error`:
173+
- Fix all **code style** issues that have severity `info`, `warning` or `error`:
165174

166175
```dotnetcli
167176
dotnet format style --severity info
168177
```
169178

170-
* Fix a specific (non code style) analyzer issue:
179+
- Fix a specific (non code style) analyzer issue:
171180

172181
```dotnetcli
173182
dotnet format analyzers --diagnostics CA1831 --severity warn
174183
```
175184

176-
* Fix all non code style issues that have severity `info`, `warning` or `error`:
185+
- Fix all non code style issues that have severity `info`, `warning` or `error`:
177186

178187
```dotnetcli
179188
dotnet format analyzers --severity info

docs/core/tools/dotnet-msbuild.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: dotnet msbuild command
33
description: The dotnet msbuild command provides access to the MSBuild command line.
4-
ms.date: 02/14/2020
4+
ms.date: 09/29/2025
55
---
66
# dotnet msbuild
77

8-
**This article applies to:** ✔️ .NET Core 3.1 SDK and later versions
8+
**This article applies to:** ✔️ .NET 6 SDK and later versions
99

1010
## Name
1111

0 commit comments

Comments
 (0)