dotnet / dotnet/sdk

Multi-arch container publishing doesn't work when certain RID-forcing publish properties are set

Open
#49,972 2 comments 1 reaction 1 assignee Claimed by @baronfel View on GitHub
Area-Containers multi-RID-publishing untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug

See [this Bluesky thread](https://bsky.app/profile/chrismckee.bsky.social/post/3lunqvhetjs2j) for context and discussion.

With multi-arch container publish being a thing, some users are using it with publish configurations that conflict with historical decisions that the .NET SDK has had. Specifically, while we would like the container publish for multi arch to logically look like

* outer build does zero work
* triggers N inner RID-specific build
* outer build uses results of inner build to make image manifest

The decision to make the `PublishContainer` target implicitly rely on the `Publish` target (via the documented command `dotnet publish -t:PublishContainer`) means that the outer project (with no RID set) is also asked to publish - and as a result if the outer project has properties like `PublishReadyToRun`, `PublishAot`, etc set then the RuntimeIdentifierInference targets force it to get a RID, which then short-circuits the decision-making of the PublishContainer target on if it is doing multi-arch publish.

One workaround is to disable `UseCurrentRuntimeIdentifier`, but the CLi today seems to not allow passing `false` for this option.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.