-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
There was a problem hiding this 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) != ''">
a6c399a
to
7abd619
Compare
Rebased now that the two parent PRs have made it into main. Let's see if that has cleared up the ILLink failures or if I have some more work to do here. |
fd4e6bb
to
e9d2919
Compare
… the question of 'would my inner packages be publishing as AOT?'
983d928
to
38e7482
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for doing cleanup and #nullable disable
removals as you were going along. I really appreciate it! 🤩
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets
Outdated
Show resolved
Hide resolved
test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Michael Yanni <[email protected]>
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 theany
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!All of the actual changes are in the .targets file, the rest is just