Repository navigation
Enable cross-architecture Native AOT tool packaging - #55250
Merged
baronfel merged 3 commits intoJul 14, 2026
Merged
Conversation
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 95142a7c-731e-4791-a2f5-ae0461aff70a
Contributor
There was a problem hiding this comment.
Pull request overview
Enables cross-architecture Native AOT tool packaging by adding an MSBuild extensibility point to compute which tool package RIDs should be packed, with SDK defaults that filter AOT packaging to host-supported target architectures.
Changes:
- Added
ComputeToolPackageRuntimeIdentifiersToPacktarget as an extensibility point for tool RID selection. - Implemented default RID filtering for AOT tools based on host RID capabilities when no explicit
ToolPackageRuntimeIdentifiersToPackitems are provided. - Added tests covering default filtering behavior, predefined item override, and
BeforeTargetscustomization.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/Microsoft.NET.ToolPack.Tests/GivenThatWeWantToPackAToolProject.cs | Adds coverage for default RID filtering and customization paths for tool RID packing. |
| src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets | Introduces the new extensibility target and default computation for ToolPackageRuntimeIdentifiersToPack, and wires it into RID-specific tool package creation. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Member
Author
|
@slang25 with this change and a Target like <Target Name="SelectAotAnywhereToolPackageRuntimeIdentifiers"
BeforeTargets="ComputeToolPackageRuntimeIdentifiersToPack">
<ItemGroup>
<ToolPackageRuntimeIdentifiersToPack Include="$(ToolPackageRuntimeIdentifiers)" />
</ItemGroup>
</Target>in a project using AotAnywhere, I was able to create an entire NAOT-layout .NET Tool package including the RID-agnostic pointer package and the RID-specific NAOT implementation packages. |
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 95142a7c-731e-4791-a2f5-ae0461aff70a
dsplaisted
approved these changes
Jul 14, 2026
slang25
added a commit
to StuDevLabs/AotAnywhere
that referenced
this pull request
Jul 14, 2026
Hook ComputeToolPackageRuntimeIdentifiersToPack (dotnet/sdk#55250, .NET 11+) so a single 'dotnet pack' on one host produces RID-specific AOT tool packages for every RID in ToolPackageRuntimeIdentifiers, instead of only the RIDs the SDK's native toolchain can build there. The new build/ToolPack.targets emits one ToolPackageRuntimeIdentifiersToPack item per requested RID, mirroring the SDK's ToolPackageRuntimeIdentifiers -> RuntimeIdentifiers fallback. It stays out of the way in inner RID-specific builds, when RID-specific tool packaging is off, when the user predefined their own items, or when AotAnywhereMultiRidToolPackaging=false. On SDKs without the extensibility point the BeforeTargets reference is ignored and the file is inert. Closes #81 Co-authored-by: Claude Fable 5 <[email protected]>
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.
Why
The .NET Tool packaging pipeline can create a pointer package plus RID-specific implementation packages in one invocation. Native AOT tools have historically been excluded from that orchestration because the base SDK cannot publish every requested RID from every host.
That restriction also blocks external packages from expanding the SDK's native cross-compilation capabilities. Packages such as AotAnywhere can provide additional Native AOT targets through toolchains such as Zig, but the Tool packaging pipeline currently has no supported way for them to tell the SDK which requested RIDs they can build. As a result, those packages cannot participate in multi-RID Native AOT tool packaging even when they can successfully publish all of the requested targets.
This change separates two responsibilities:
Packbuild for each selected RID.What changed
ComputeToolPackageRuntimeIdentifiersToPackmarker target as an extensibility point.BeforeTargets="ComputeToolPackageRuntimeIdentifiersToPack", inspect inputs such asToolPackageRuntimeIdentifiersandRuntimeIdentifiers, and emit oneToolPackageRuntimeIdentifiersToPackitem per supported RID.win-x64andwin-arm64Native AOT tools;osx-x64andosx-arm64Native AOT tools;_CreateRIDSpecificToolPackagesthen performs the existing inner-package orchestration for the selected items.This keeps the base SDK's behavior limited to combinations supported by its native toolchain while allowing packages such as AotAnywhere to replace that capability decision without replacing the packaging pipeline.
Testing
BeforeTargetscustomization.GivenThatWeWantToPackAToolProject: 91 passed, 4 skipped.