Skip to content

Enable NativeAOT dotnet CLI for Source Build#55329

Merged
baronfel merged 6 commits into
mainfrom
baronfel-enable-aot-cli-source-build
Jul 20, 2026
Merged

Enable NativeAOT dotnet CLI for Source Build#55329
baronfel merged 6 commits into
mainfrom
baronfel-enable-aot-cli-source-build

Conversation

@baronfel

@baronfel baronfel commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • enable the NativeAOT dotnet CLI library for supported Source Build configurations
  • make Source Build TargetRid an exact supported RID for the regular runtime packs and ILCompiler pack, matching the existing Arcade/ASP.NET Core pattern without enabling the legacy RID graph
  • reuse the existing HostOS, TargetOS, OSName, BuildArchitecture, TargetArchitecture, CrossBuild, and NativeAotSupported properties when deciding whether the layout can publish dotnet-aot
  • rely on the nested MSBuild invocation to inherit Source Build and target global properties; pass only _IsPublishing=true and, for same-OS cross-architecture publishing, CrossBuild=true explicitly
  • preserve linux-musl, Mono, cross-OS, unsupported-architecture, and Linux cross-toolchain exclusions

Validation

  • unified build 1514187 succeeded, including VMR Source-Only Build and SB_CentOSStream10_Online_MsftSdk_x64
  • verified the CentOS Source Build publishes with RuntimeIdentifier=centos.10-x64 and UseRidGraph=false
  • verified exact resolution of Microsoft.NETCore.App.Runtime.centos.10-x64, Microsoft.AspNetCore.App.Runtime.centos.10-x64, and Microsoft.NETCore.App.Runtime.NativeAOT.centos.10-x64
  • verified the produced CentOS SDK tarball contains dotnet.dll and libdotnet-aot.so together under sdk/11.0.100-ci/
  • verified a nested MSBuild invocation passing only _IsPublishing=true inherits the Source Build target properties and retains the same runtime-pack inference
  • built and NativeAOT-published dotnet-aot.csproj for win-x64, and ran the NativeAOT CLI parser tests
  • standard PR build 1514172 succeeded

Fixes #55283

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: eaed26de-227d-466f-a063-c09bc7334995
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@baronfel

Copy link
Copy Markdown
Member Author

/azp run sdk-unified-build

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: eaed26de-227d-466f-a063-c09bc7334995
@baronfel

Copy link
Copy Markdown
Member Author

/azp run sdk-unified-build

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: eaed26de-227d-466f-a063-c09bc7334995
@baronfel

Copy link
Copy Markdown
Member Author

/azp run sdk-unified-build

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

baronfel and others added 2 commits July 17, 2026 09:49
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: eaed26de-227d-466f-a063-c09bc7334995
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: eaed26de-227d-466f-a063-c09bc7334995
@baronfel
baronfel requested a review from a team July 17, 2026 15:34
@baronfel baronfel added Area-SourceBuild Area-dotnet AOT Items that are part of the dotnet CLI AOT-ification effort labels Jul 17, 2026
@baronfel
baronfel marked this pull request as ready for review July 17, 2026 15:35
Copilot AI review requested due to automatic review settings July 17, 2026 15:35
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@baronfel

Copy link
Copy Markdown
Member Author

/azp run sdk-unified-build

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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

Enables publishing the NativeAOT dotnet-aot shared library as part of the SDK layout for supported Source Build configurations, including distro-specific RIDs, while keeping existing exclusions (linux-musl, Mono, cross-OS, unsupported arch, and Linux cross-toolchain constraints).

Changes:

  • Update layout gating for dotnet-aot publishing to use TargetOS/HostOS + NativeAotSupported (instead of RID-prefix checks) so Source Build distro-specific TargetRid is supported.
  • Adjust the nested dotnet-aot publish invocation to rely on inherited global properties, only forcing _IsPublishing=true and (when applicable) CrossBuild=true.
  • Extend known runtime/ILCompiler RID lists during Source Build so exact distro-specific pack RID matches work without enabling the portable RID graph.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Layout/redist/targets/GenerateLayout.targets Simplifies dotnet-aot publish property forwarding to rely on inherited global properties; keeps cross-build signaling via CrossBuild=true.
src/Layout/redist/redist.csproj Updates the rationale for conditioning the dotnet-aot.csproj reference on _ShouldPublishDotnetAot, including Source Build behavior.
src/Layout/Directory.Build.props Reworks _ShouldPublishDotnetAot gating to be OS/arch-based (and Source Build–friendly) and ties it to NativeAotSupported/Mono exclusions.
Directory.Build.targets Adds $(TargetRid) to runtime pack and ILCompiler runtime identifier lists for Source Build to allow exact RID pack resolution without RID graph reliance.

Comment thread src/Layout/Directory.Build.props
Comment thread src/Layout/Directory.Build.props Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: eaed26de-227d-466f-a063-c09bc7334995
@mthalman

Copy link
Copy Markdown
Member

/azp run sdk-unified-build

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mthalman mthalman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Assuming UB pipeline is good, then I'm good.

@baronfel

Copy link
Copy Markdown
Member Author

@mthalman looks like UB pipeline is good - we are getting libdotnet-aot.so binaries getting made. Merging!

@baronfel
baronfel merged commit a753149 into main Jul 20, 2026
43 checks passed
@baronfel
baronfel deleted the baronfel-enable-aot-cli-source-build branch July 20, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-dotnet AOT Items that are part of the dotnet CLI AOT-ification effort Area-SourceBuild

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable NAOT dotnet CLI package for Source Build

3 participants