Skip to content

Pack RID-specific tool pointer packages with DotnetToolSettings.xml under tools/any/any - #55107

Merged
baronfel merged 4 commits into
mainfrom
copilot/update-pointer-package-tfm
Jul 6, 2026
Merged

baronfel merged 4 commits into
mainfrom
copilot/update-pointer-package-tfm

Conversation

Copilot AI commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

RID-specific tool packaging currently places the top-level pointer package's DotnetToolSettings.xml under a concrete TFM path. This change makes the pointer package emit the settings file under tools/any/any so the package remains TFM-agnostic while still pointing to the RID-specific payload packages.

  • Packaging layout

    • Update Microsoft.NET.PackTool.targets so the top-level RID-specific pointer package writes DotnetToolSettings.xml to tools/any/any/.
    • Leave implementation packages unchanged; they still use their existing TFM/RID-specific layout.
  • Pointer package behavior

    • Apply the any TFM path only when packing the RID-specific top-level package that contains metadata but no implementation files.
    • Preserve the existing settings generation and RID declarations inside the XML.
  • Coverage

    • Extend tool packaging end-to-end assertions to verify the pointer package contains exactly one DotnetToolSettings.xml and that its path is tools/any/any/DotnetToolSettings.xml.
    • Cover 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/...

Copilot AI changed the title [WIP] Update pointer package to use any TFM for compatibility Pack RID-specific tool pointer packages with DotnetToolSettings.xml under tools/any/any Jul 1, 2026
Copilot AI requested a review from baronfel July 1, 2026 19:40
Copilot AI requested a review from baronfel July 1, 2026 19:59
@baronfel
baronfel marked this pull request as ready for review July 1, 2026 20:00
@baronfel
baronfel requested review from Copilot and dsplaisted July 1, 2026 20:00
@baronfel

baronfel commented Jul 1, 2026

Copy link
Copy Markdown
Member

When we merge this we should backport to 10.0.4xx as well.

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

This PR updates the RID-specific pointer tool package layout so that DotnetToolSettings.xml is emitted under tools/any/any/, keeping the pointer package TFM-agnostic while still referencing RID-specific implementation packages.

Changes:

  • Adjust Microsoft.NET.PackTool.targets to place the pointer package’s DotnetToolSettings.xml under tools/any/any/ (while keeping implementation packages’ existing TFM/RID layout).
  • Extend end-to-end tool packaging assertions to validate the pointer package contains exactly one DotnetToolSettings.xml and that it lives at 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 assertions to verify the pointer package has a single DotnetToolSettings.xml at tools/any/any/.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets Updates packing logic to emit DotnetToolSettings.xml to a TFM-agnostic tools/any/any/ path for RID-specific pointer packages.

@baronfel
baronfel merged commit f64ec67 into main Jul 6, 2026
28 checks passed
@baronfel
baronfel deleted the copilot/update-pointer-package-tfm branch July 6, 2026 14:10
@baronfel

baronfel commented Jul 6, 2026

Copy link
Copy Markdown
Member

/backport to release/10.0.4xx

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.4xx (link to workflow run)

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@baronfel backporting to release/10.0.4xx failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Creating an empty commit: Initial plan
Applying: Use any TFM for pointer tool settings
Using index info to reconstruct a base tree...
M	src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets
M	test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets
Auto-merging test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs
CONFLICT (content): Merge conflict in test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Use any TFM for pointer tool settings
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

@MaceWindu

Copy link
Copy Markdown

@copilot, 👍

Multi-TFM builds produce errors now:

C:\hostedtoolcache\windows\dotnet\sdk\10.0.400\NuGet.Build.Tasks.Pack.targets(226,5): error NU5118: Warning As Error: File 'D:\a\1\s\.build\obj\LinqToDB.CLI\Release\net8.0\DotnetToolSettings.xml' is not added because the package already contains file 'tools\any\any\DotnetToolSettings.xml' [D:\a\1\s\Source\LinqToDB.CLI\LinqToDB.CLI.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\10.0.400\NuGet.Build.Tasks.Pack.targets(226,5): error NU5118: Warning As Error: File 'D:\a\1\s\.build\obj\LinqToDB.CLI\Release\net9.0\DotnetToolSettings.xml' is not added because the package already contains file 'tools\any\any\DotnetToolSettings.xml' [D:\a\1\s\Source\LinqToDB.CLI\LinqToDB.CLI.csproj]

MaceWindu added a commit to linq2db/linq2db that referenced this pull request Aug 12, 2026
The build CI job has failed on every PR since 2026-08-11 (first red run 22738, last green 22735) with two NU5118 errors on LinqToDB.CLI during dotnet pack linq2db.slnx. The trigger is the hosted agent's SDK rolling from 10.0.302 to 10.0.400, not any repo change: build-job.yml requests bare 10.x and global.json allows minor roll-forward.

dotnet/sdk#55107 moved the RID pointer package's DotnetToolSettings.xml to a TFM-agnostic tools/any/any/ path, but PackTool runs once per TFM. With TargetFrameworks net8.0, net9.0 and net10.0, all three passes emit that same package path, so NuGet reports a collision that TreatWarningsAsErrors turns fatal. The upstream test asserts the pointer package holds exactly one settings file, which only holds for single-TFM tools.

The three generated files are byte-identical (matching SHA-256): the pointer settings carry only ToolCommandName plus the per-RID sub-package ids, nothing TFM-specific. NuGet keeping the first and skipping the duplicates is therefore lossless, and NoWarn yields exactly the single-settings-file layout the new SDK intends. Scoped to the pointer package so the seven per-RID packs keep NU5118 enforcement.

Verified locally on SDK 10.0.400: full pack exits 0 with no warnings, the pointer package holds exactly one tools/any/any/DotnetToolSettings.xml listing all seven RIDs with packageType DotnetTool, each RID sub-package retains its per-TFM tools/net8.0, net9.0 and net10.0 layout, and verify-nuget-sizes.ps1 passes 8 of 8.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

5 participants