Skip to content

dotnet-publish: Which "publish-related properties" are supported? #34017

@NightProgramming

Description

@NightProgramming

Here the docs say:

You can also set publish-related properties by referring to a .pubxml file. For example:
dotnet publish -p:PublishProfile=FolderProfile

I would have assumed for instance that the DeleteExistingFiles property inside .pubxml is a publish-related property but it is ignored by dotnet publish.

Also the LastUsedBuildConfiguration seems to be ignored because dotnet publish still builds and copies the Debug dlls, not the Release dlls although I have specified:

<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>

Is LastUsedBuildConfiguration not a publish-related property? I would have guessed that it is.

I think it's not a mistake on my end because the PublishDir setting in .pubxml is honored when I do dotnet publish and the DeleteExistingFiles and LastUsedBuildConfiguration settings are honored when publishing via Visual Studio. Maybe DeleteExistingFiles and LastUsedBuildConfiguration are meant to only be used by Visual Studio but the docs here only mention PublishUrl to be meant to be used by Visual Studio.

I think it would be very helpful to write in the docs which publish-related properties exactly are supported by dotnet publish in order to avoid confusion and maybe also it should be mentioned what the necessary replacements are for unsupported publish-related properties, e.g. --configuration argument has to be used instead of LastUsedBuildConfiguration setting.

Using .NET 7 SDK and tested with a completely new ASP.NET Core Web Application project. I didn't test any other publish-related properties.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 66017

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.cli/subsvcdotnet-fundamentals/svcokr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions