Skip to content

Commit 4da9f0c

Browse files
authored
Note different .pubxml handling by VS and CLI (#34269)
* Note different .pubxml handling by VS and CLI * tweak wording * Update docs/core/tools/dotnet-publish.md * Update docs/core/tools/dotnet-publish.md * Apply suggestions from code review * Update docs/core/tools/dotnet-publish.md
1 parent 22c0af3 commit 4da9f0c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/core/tools/dotnet-publish.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Any parameters passed to `dotnet publish` are passed to MSBuild. The `-c` and `-
5050

5151
The `dotnet publish` command accepts MSBuild options, such as `-p` for setting properties and `-l` to define a logger. For example, you can set an MSBuild property by using the format: `-p:<NAME>=<VALUE>`.
5252

53+
### .pubxml files
54+
5355
You can also set publish-related properties by referring to a *.pubxml* file. For example:
5456

5557
```dotnetcli
@@ -65,6 +67,19 @@ In the *.pubxml* file:
6567

6668
If you want the scenario to work in all places, you can initialize both these properties to the same value in the *.pubxml* file. When GitHub issue [dotnet/sdk#20931](https://github.com/dotnet/sdk/issues/20931) is resolved, only one of these properties will need to be set.
6769

70+
Some properties in the *.pubxml* file are honored only by Visual Studio and have no effect on `dotnet publish`. We're working to bring the CLI more into alignment with Visual Studio's behavior. But some properties will never be used by the CLI. The CLI and Visual Studio both do the packaging aspect of publishing, and [dotnet/sdk#29817](https://github.com/dotnet/sdk/pull/29817) plans to add support for more properties related to that. But the CLI doesn't do the deployment automation aspect of publishing, and properties related to that are not supported. The most notable *.pubxml* properties that are not supported by `dotnet publish` are the following ones that impact the build:
71+
72+
* `LastUsedBuildConfiguration`
73+
* `Configuration`
74+
* `Platform`
75+
* `LastUsedPlatform`
76+
* `TargetFramework`
77+
* `TargetFrameworks`
78+
* `RuntimeIdentifier`
79+
* `RuntimeIdentifiers`
80+
81+
### MSBuild properties
82+
6883
The following MSBuild properties change the output of `dotnet publish`.
6984

7085
- `PublishReadyToRun`

0 commit comments

Comments
 (0)