Skip to content

Restore dotnet-aot to same-arch Linux SDK builds - #7987

Merged
baronfel merged 1 commit into
mainfrom
baronfel-restore-linux-aot-library
Jul 27, 2026
Merged

baronfel merged 1 commit into
mainfrom
baronfel-restore-linux-aot-library

Conversation

@baronfel

Copy link
Copy Markdown
Member

Summary

  • classify same-OS, same-architecture SDK layout builds as native even when CrossBuild=true
  • preserve the existing cross-architecture, cross-OS, linux-musl, Mono, unsupported-OS, and NativeAotSupported safeguards
  • allow the normal VMR Linux_x64 build, which uses a same-architecture rootfs, to include and publish libdotnet-aot.so

Fixes #7981

Root cause

The Linux_x64 VMR job targets Linux x64 from a Linux x64 host, but its same-architecture rootfs causes CrossBuild=true to flow into SDK layout.

The layout gate classified a build as native only when the architectures matched and CrossBuild was not true. It classified a build as cross only when the architectures differed. The VMR job therefore matched neither branch, leaving _ShouldPublishDotnetAot=false.

TargetArchitecture == BuildArchitecture is the native-versus-cross-architecture signal. CrossBuild can independently indicate that a rootfs/toolchain is in use, including for the same architecture.

MSBuild evaluation proof

Evaluated src/sdk/src/Layout/redist/redist.csproj with dotnet msbuild, querying:

-getProperty:_DotnetAotIsNativeBuild,_DotnetAotIsCrossBuild,_ShouldPublishDotnetAot

The exact regression configuration now produces:

TargetOS=linux
HostOS=linux
TargetArchitecture=x64
BuildArchitecture=x64
TargetRid=linux-x64
OSName=linux
CrossBuild=true
NativeAotSupported=true
DotNetBuildUseMonoRuntime=false

_DotnetAotIsNativeBuild=true
_DotnetAotIsCrossBuild=
_ShouldPublishDotnetAot=true

The surrounding decision matrix produced:

Configuration Native Cross Publish
Linux x64 → x64, CrossBuild=false true empty true
Linux x64 → x64, CrossBuild=true true empty true
Linux x64 → arm64, CrossBuild=true empty true true
Linux x64 → arm64, CrossBuild=false empty empty false
Cross-OS empty empty false
linux-musl empty empty false
NativeAotSupported=false true empty false
Mono runtime true empty false
Unsupported target OS true empty false

Also queried the evaluated ProjectReference items. For the VMR regression configuration:

_ShouldPublishDotnetAot=true
dotnet-aot project references=1

For Linux x64 → arm64 without CrossBuild=true:

_ShouldPublishDotnetAot=false
dotnet-aot project references=0

This confirms the corrected shared gate both enables PublishDotnetAot and includes dotnet-aot.csproj in the restore/build graph for the affected VMR configuration, while preserving the Linux cross-architecture toolchain guard.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: b5a10383-b914-4ad8-858c-694b7f104f51
Copilot AI review requested due to automatic review settings July 27, 2026 19:27
@azure-pipelines

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

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 fixes the SDK layout gate that determines whether dotnet-aot (and therefore libdotnet-aot.so) should be published for same-OS builds, ensuring same-architecture Linux SDK layout builds remain “native” even when CrossBuild=true due to using a same-arch rootfs.

Changes:

  • Updates the “native build” condition to be based on same OS + same architecture (and not on CrossBuild=false), allowing same-arch rootfs builds to publish dotnet-aot.
  • Keeps existing exclusions/guards (notably linux-musl exclusion and Linux cross-arch requiring CrossBuild=true) intact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@baronfel
baronfel merged commit f74e9ae into main Jul 27, 2026
12 checks passed
@baronfel
baronfel deleted the baronfel-restore-linux-aot-library branch July 27, 2026 22:01
@baronfel

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx-preview7

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team July 27, 2026 22:01
@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx-preview7 (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Operational Issue]: VMR Linux_x64 SDK is missing libdotnet-aot.so

3 participants