Skip to content

Commit b00c7ce

Browse files
committed
Clarify .NET version applicability and update command options in dotnet publish documentation
1 parent b92c74f commit b00c7ce

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

docs/core/tools/dotnet-publish.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.date: 09/24/2025
55
---
66
# dotnet publish
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

@@ -21,9 +21,9 @@ dotnet publish [<PROJECT>|<SOLUTION>|<FILE>] [-a|--arch <ARCHITECTURE>]
2121
[--manifest <PATH_TO_MANIFEST_FILE>] [--no-build] [--no-dependencies]
2222
[--no-restore] [--nologo] [-o|--output <OUTPUT_DIRECTORY>]
2323
[--os <OS>] [-r|--runtime <RUNTIME_IDENTIFIER>]
24-
[--sc|--self-contained [true|false]] [--no-self-contained]
24+
[--sc|--self-contained] [--no-self-contained]
2525
[-s|--source <SOURCE>] [--tl:[auto|on|off]]
26-
[--use-current-runtime, --ucr [true|false]]
26+
[--ucr|--use-current-runtime]
2727
[-v|--verbosity <LEVEL>] [--version-suffix <VERSION_SUFFIX>]
2828
2929
dotnet publish -h|--help
@@ -134,9 +134,7 @@ For more information, see the following resources:
134134

135135
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.
136136

137-
[!INCLUDE [help](../../../includes/cli-help.md)]
138-
139-
[!INCLUDE [interactive](../../../includes/cli-interactive-3-0.md)]
137+
[!INCLUDE [interactive](../../../includes/cli-interactive.md)]
140138

141139
- **`--manifest <PATH_TO_MANIFEST_FILE>`**
142140

@@ -182,11 +180,9 @@ For more information, see the following resources:
182180

183181
[!INCLUDE [os](../../../includes/cli-os.md)]
184182

185-
- **`--sc|--self-contained [true|false]`**
186-
187-
Publishes the .NET runtime with your application so the runtime doesn't need to be installed on the target machine. Default is `true` if a runtime identifier is specified and the project is an executable project (not a library project). For more information, see [Self-contained deployment](../deploying/index.md#self-contained-deployment).
183+
- **`--sc|--self-contained`**
188184

189-
If this option is used without specifying `true` or `false`, the default is `true`. In that case, don't put the solution or project argument immediately after `--self-contained`, because `true` or `false` is expected in that position.
185+
Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is `false`. However, when targeting .NET 7 or lower, the default is `true` if a runtime identifier is specified. Available since .NET 6 SDK.
190186

191187
- **`--no-self-contained`**
192188

@@ -202,16 +198,18 @@ For more information, see the following resources:
202198

203199
[!INCLUDE [tl](../../../includes/cli-tl.md)]
204200

205-
- **`--use-current-runtime, --ucr [true|false]`**
201+
- **`--ucr|--use-current-runtime`**
206202

207-
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.
203+
Use current runtime as the target runtime. The default is `false`.
208204

209205
[!INCLUDE [verbosity](../../../includes/cli-verbosity-minimal.md)]
210206

211207
- **`--version-suffix <VERSION_SUFFIX>`**
212208

213209
Defines the version suffix to replace the asterisk (`*`) in the version field of the project file.
214210

211+
[!INCLUDE [help](../../../includes/cli-help.md)]
212+
215213
## Examples
216214

217215
- Create a [framework-dependent cross-platform binary](../deploying/index.md#cross-platform-dll-deployment) for the project in the current directory:

0 commit comments

Comments
 (0)