Skip to content

[release/10.0.4xx] Pack RID-specific tool pointer packages with DotnetToolSettings.xml under tools/any/any - #55142

Merged
baronfel merged 1 commit into
release/10.0.4xxfrom
backport-55107-10.0.4xx
Jul 6, 2026
Merged

baronfel merged 1 commit into
release/10.0.4xxfrom
backport-55107-10.0.4xx

Conversation

@baronfel

@baronfel baronfel commented Jul 6, 2026 •

Copy link
Copy Markdown
Member

Backport of #55107 to release/10.0.4xx.

Why this is needed

When packing a RID-specific .NET tool, the SDK produces a top-level "pointer" package plus one implementation package per RID. The pointer package is metadata-only: it declares the available RIDs and points consumers at the correct RID-specific implementation package to download. It contains no tool binaries.

Previously the SDK wrote the pointer package's DotnetToolSettings.xml under a concrete TFM/RID path (e.g. tools/net11.0/<rid>/). That coupled the TFM-agnostic pointer to a specific target framework path, which is inconsistent with the pointer's role and can lead to the settings file not being discovered as expected for the pointer package. The pointer should be TFM- and RID-agnostic, since it exists only to route consumers to the real payload packages.

What changed

  • Packaging layout (Microsoft.NET.PackTool.targets)

    • The top-level RID-specific pointer package now writes DotnetToolSettings.xml to tools/any/any/, keeping the pointer TFM- and RID-agnostic.
    • Implementation packages are unchanged; they keep their existing TFM/RID-specific layout (e.g. tools/net11.0/linux-x64/...).
  • Pointer package behavior

    • The any/any path is applied only when packing the RID-specific top-level package that contains metadata but no implementation files.
    • The existing settings generation and RID declarations inside the XML are preserved.
  • Coverage (EndToEndToolTests.cs)

    • End-to-end assertions verify the pointer package contains exactly one DotnetToolSettings.xml and that its path is tools/any/any/DotnetToolSettings.xml.
    • Covers both standard RID-specific packages and the variant that also includes an any RID payload.
<!-- top-level pointer package -->
tools/any/any/DotnetToolSettings.xml

<!-- RID-specific implementation package -->
tools/net11.0/linux-x64/...

Backport notes

Cherry-picked from squash merge commit f64ec67374cd10769878f458fb1825e4b36999a1. The EndToEndToolTests.cs change had a conflict because the Net99Tool-related tests do not exist on release/10.0.4xx; only the relevant additions from the original PR were carried over (the GetToolSettingsFileEntry and EnsureToolSettingsFileUsesAnyTfmAndRid helpers, their call sites, and the GetToolSettingsFile refactor). The Microsoft.NET.PackTool.targets change applied cleanly.

…nder tools/any/any (#55107)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: baronfel <[email protected]>
(cherry picked from commit f64ec67)
Copilot AI review requested due to automatic review settings July 6, 2026 14:15
@baronfel
baronfel requested review from a team and dsplaisted July 6, 2026 14:17
@baronfel baronfel added Area-Tools cli-ux Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on) labels Jul 6, 2026
@baronfel baronfel added this to the 10.0.4xx milestone Jul 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates RID-specific .NET tool packaging so the top-level “pointer” package remains TFM-agnostic by emitting DotnetToolSettings.xml under tools/any/any/, while keeping RID/TMF-specific implementation package layouts unchanged.

Changes:

  • Adjust Microsoft.NET.PackTool.targets to place the pointer package’s DotnetToolSettings.xml under tools/any/any/ (only for RID-specific top-level packages without implementation).
  • Update end-to-end tool packaging assertions to ensure exactly one DotnetToolSettings.xml exists and that its path is tools/any/any/DotnetToolSettings.xml.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs Adds helper/assertions to validate the settings file is unique and located at tools/any/any/DotnetToolSettings.xml in the pointer package.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets Changes packing logic so the RID-specific pointer package writes DotnetToolSettings.xml to a TFM-agnostic path (tools/any/any/).

@baronfel

baronfel commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

I checked mergeability against origin/release/10.0.4xx locally and this branch is already conflict-free (e19bb9b). No additional merge commit was needed.

@baronfel
baronfel changed the base branch from main to release/10.0.4xx July 6, 2026 15:32
@baronfel
baronfel enabled auto-merge (squash) July 6, 2026 15:47
@baronfel
baronfel merged commit 3e3748c into release/10.0.4xx Jul 6, 2026
33 of 37 checks passed
@baronfel
baronfel deleted the backport-55107-10.0.4xx branch July 6, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Tools cli-ux Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RID-specific tool packaging should make the top-level pointer package use the any TFM for improved compatibility

4 participants