Skip to content

Support any RID in multi-RID tools #49505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

baronfel
Copy link
Member

@baronfel baronfel commented Jun 20, 2025

This builds on top of #49501 and #49521, so it's in draft still.

Fixes #49499 by adding support for the any RID. This RID can be specified, but if it is it must never trigger any of the apphost, linking, etc related Publish* properties. So I've added clauses to always force the Publish* properties to false for the any RID, and then everything else more or less falls into place!

I've been able to test this end to end by removing the win-x64 RID from my set of supported RIDs and then running the generated tool. Because we do RID negotiation, and because the any RID is explicitly packed as a FDD tool, everything just works!

@baronfel baronfel marked this pull request as ready for review June 20, 2025 04:45
@Copilot Copilot AI review requested due to automatic review settings June 20, 2025 04:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for the special "any" RID in multi-RID tools by ensuring that Publish* properties are forced to false when "any" is specified. Key changes include updating test tool settings to add Trimmed and IncludeAnyRid flags, extending end-to-end tests to verify the new behavior, and modifying MSBuild targets to conditionally disable publish features when the "any" RID is used.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs Adds new properties and updates identifier string logic to include "trimmed" and "anyrid" suffixes.
test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs Introduces additional tests covering trimmed and any RID scenarios.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets Adjusts MSBuild conditions to disable publish features for RID-agnostic builds and adds a new property to detect RID-specific builds.
Comments suppressed due to low confidence (2)

test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs:40

  • [nitpick] Consider adding parentheses to the nested ternary expressions in the GetIdentifier method for improved readability and maintainability.
            public string GetIdentifier() => $"{ToolPackageId}-{ToolPackageVersion}-{ToolCommandName}-{(NativeAOT ? "nativeaot" : SelfContained ? "selfcontained" : Trimmed ? "trimmed" : "managed")}{(IncludeAnyRid ? "-anyrid" : "")}";

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets:140

  • The removal of quotes around $(RuntimeIdentifier) in the condition may affect string comparison behavior; please verify that the condition is evaluated as intended.
    <PropertyGroup Condition="'$(_HasRIDSpecificTools)' != '' And $(RuntimeIdentifier) != ''">

@baronfel baronfel force-pushed the tinker-any-rid-tool branch 2 times, most recently from f8240a4 to abbd4a6 Compare June 20, 2025 19:32
@baronfel baronfel force-pushed the tinker-any-rid-tool branch from abbd4a6 to c0cbfd9 Compare June 22, 2025 05:07
@baronfel baronfel force-pushed the tinker-any-rid-tool branch from c0cbfd9 to 13a6648 Compare June 22, 2025 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The new RID-specific tools should support a fallback for framework dependent, RID-agnostic tools
1 participant