Multi-arch container publishing conflicts with the --output
option in dotnet publish
#46109
Labels
Area-Containers
Related to dotnet SDK containers functionality
Area-NetSDK
untriaged
Request triage from a team member
Describe the bug
Invoking a multi-arch container publish of a project while also overriding the
PublishDir
results in the per-RID inner builds all having the samePublishDir
. This results in race conditions during the build, and if there are any native, RID-specific assets in the build can result in mixing assets for different platforms.To Reproduce
Using .NET SDK 9.0.102 or .NET SDK 8.0.405 or later,
dotnet new webapi
<RuntimeIdentifiers>linux-x64;linux-arm64</RuntimeIdentifiers>
dotnet publish -t:PublishContainer --output <some directory>
Details
What's happening here is that the
--output
CLI arg is passing thePublishDir
global property with a value ofbugsville
to MSBuild. This is used for the 'outer' publish successfully, but because a multi-arch container publish is triggered, we do two RID-specific inner publishes in parallel. These are done with the same values of PublishDir, which causes the conflicts.Potential solutions
AdditionalProperties
on the inner builds to set a new value of PublishDir--output
mean a different property for a multi-RID build and define what PublishDir should be in terms of that propertyRemoveProperties
on theMSBuild
Task invocations for the inner buildsCommentary
This is coming up because, unlike for multi-TFM builds, we're not blocking publishing for multiple RIDs. The Publish target for multi-targeted builds even says:
Yet here we are.
The text was updated successfully, but these errors were encountered: