Repository navigation
Add escape hatch for PublishRuntimeIdentifier being appended to RuntimeIdentifiers by default - #54291
Merged
rolfbjarne merged 2 commits intoJun 16, 2026
Merged
Conversation
…meIdentifiers by default This adds an escape hatch (setting 'AppendPublishRuntimeIdentifierToRuntimeIdentifiers=false') for not appending `PublishRuntimeIdentifier` to `RuntimeIdentifiers` by default. The default behavior causes problems when "RuntimeIdentifiers" is used to mean "build for all these RIDs", and not only "restore all these RIDs" - which the mobile workloads do, because "RuntimeIdentifiers" will now always contain the publishing RID, and our build end up confused (we end up showing a validation error: "can't set both 'RuntimeIdentifier' and 'RuntimeIdentifiers'"). Add tests too. And add tests for `UseDefaultPublishRuntimeIdentifier` (requested in a review in dotnet#52566). Ref: dotnet/macios#24547 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an SDK escape hatch to prevent PublishRuntimeIdentifier from being appended to RuntimeIdentifiers, supporting workloads that use RuntimeIdentifiers as a build orchestration list rather than only a restore list.
Changes:
- Adds
AppendPublishRuntimeIdentifierToRuntimeIdentifiers=falseopt-out logic. - Adds publish/runtime identifier inference tests covering the new opt-out and existing default behavior.
- Adds coverage for
UseDefaultPublishRuntimeIdentifier=false.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets |
Gates the automatic append of PublishRuntimeIdentifier to RuntimeIdentifiers behind the new opt-out property. |
test/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs |
Adds tests for default append behavior, opt-out behavior, and default publish RID inference opt-out. |
rolfbjarne
marked this pull request as ready for review
May 13, 2026 16:53
Member
Author
|
CC @baronfel |
baronfel
approved these changes
Jun 16, 2026
baronfel
left a comment
Member
There was a problem hiding this comment.
Seems totally reasonable to have an escape hatch, my main concern is coverage if this drifts out of sync :) But the tests should help pin that.
rolfbjarne
added a commit
to dotnet/macios
that referenced
this pull request
Jul 16, 2026
…26013) Now that dotnet/sdk#54291 has merged and is available in our bundled SDK, we can set a default `PublishRuntimeIdentifier` again. ## Background We previously had to stop setting `PublishRuntimeIdentifier` because the .NET SDK appends it to `RuntimeIdentifiers`. We use `RuntimeIdentifiers` to mean "build for all these RIDs" (not just "restore for these RIDs"), so the appended publish RID left both `RuntimeIdentifier` and `RuntimeIdentifiers` set at the same time, which our build rejects with a validation error. ## Change - Re-enable the default `PublishRuntimeIdentifier` (`ios-arm64` / `tvos-arm64`). - Opt out of the SDK appending it to `RuntimeIdentifiers` via the new escape hatch `AppendPublishRuntimeIdentifierToRuntimeIdentifiers=false` (added in dotnet/sdk#54291). - Add a regression test verifying `PublishRuntimeIdentifier` is set but is not appended to `RuntimeIdentifiers`. Fixes #24547 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds an escape hatch (setting 'AppendPublishRuntimeIdentifierToRuntimeIdentifiers=false') for not appending
PublishRuntimeIdentifiertoRuntimeIdentifiersby default.The default behavior causes problems when "RuntimeIdentifiers" is used to mean "build for all these RIDs", and not only "restore all these RIDs" - which the mobile workloads do, because "RuntimeIdentifiers" will now always contain the publishing RID, and our build end up confused (we end up showing a validation error: "can't set both 'RuntimeIdentifier' and 'RuntimeIdentifiers'").
Add tests too.
And add tests for
UseDefaultPublishRuntimeIdentifier(requested in a review in #52566).Ref: dotnet/macios#24547