Skip to content

[NativeAOT] Let SDK select ILCompiler version - #12356

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-allow-nativeaot-ilc-divergence
Aug 12, 2026
Merged

[NativeAOT] Let SDK select ILCompiler version#12356
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-allow-nativeaot-ilc-divergence

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Summary

The Android workload currently pins Microsoft.DotNet.ILCompiler to the runtime version used to build the workload. This couples NativeAOT compiler updates to Android workload rebuilds instead of allowing the installed .NET SDK to select its compiler pack.

Remove the ILCompiler version override. Android runtime-pack RID and version selection remain unchanged and can intentionally diverge from the SDK-selected compiler version.


  • Useful description of why the change is necessary.
  • Links to issues fixed: N/A
  • Unit tests: N/A; this removes a version-policy override without changing runtime-pack restore logic.

Do not pin Microsoft.DotNet.ILCompiler to the runtime version used to build the Android workload. Let the installed .NET SDK select its compiler pack so SDK servicing does not require rebuilding the Android workload.

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

Copilot-Session: d491dde7-1e63-4f1b-abaa-c8405b8adb89
Copilot AI lite review requested due to automatic review settings August 12, 2026 13:08

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 removes the Android workload’s MSBuild override that forced Microsoft.DotNet.ILCompiler to use the workload build-time runtime version, allowing the installed .NET SDK to select the ILCompiler pack version instead. This decouples NativeAOT compiler updates from Android workload rebuilds while keeping Android runtime-pack RID/version selection behavior unchanged.

Changes:

  • Removed the KnownILCompilerPack metadata update that pinned Microsoft.DotNet.ILCompiler to $(MicrosoftNETCoreAppRefPackageVersion).
  • Kept existing NativeAOT runtime-pack selection logic intact (still setting LatestRuntimeFrameworkVersion for the NativeAOT-labeled Microsoft.NETCore.App runtime pack).

<KnownRuntimePack Include="@(_AndroidNetCoreAppNativeAotKnownRuntimePack)">
<LatestRuntimeFrameworkVersion>$(MicrosoftNETCoreAppRefPackageVersion)</LatestRuntimeFrameworkVersion>
<RuntimePackRuntimeIdentifiers>%(RuntimePackRuntimeIdentifiers);android-arm</RuntimePackRuntimeIdentifiers>
</KnownRuntimePack>

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.

this also seems like it might cause issues, KnownRuntimePack should have android-arm for nativeaot now

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.

hm actually, looks like it's not in sdk yet...

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

filed follow-up: #12362

jonpryor added a commit to unoplatform/uno that referenced this pull request Aug 12, 2026
Context: dotnet/android#12356

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj -p:UnoTargetFrameworkOverride=net11.0-android -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true -bl
	dotnet build -f net11.0-ios -c Release -p:UnoTargetFrameworkOverride=net11.0-ios -bl src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj

	# Android+NativeAOT
	dotnet publish -f net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -r android-arm64 -p:UnoTargetFrameworkOverride=net11.0-android -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1 -bl

Note: Android+NativeAOT build fails by default, due to a bug in
.NET 11 Preview 7:

	% dotnet publish src/SamplesApp/SamplesApp/SamplesApp.csproj -r android-arm64 -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1 -bl
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1603: Warning As Error: SamplesApp depends on Microsoft.DotNet.ILCompiler (>= 11.0.0-preview.7.26378.119) but Microsoft.DotNet.ILCompiler 11.0.0-preview.7.26378.119 was not found. Microsoft.DotNet.ILCompiler 11.0.0-preview.7.26381.103 was resolved instead.
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-preview.7.26378.119)
	        - Found 21 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-x64 with version (= 11.0.0-preview.7.26378.119)
	        - Found 21 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package runtime.osx-arm64.Microsoft.DotNet.ILCompiler with version (= 11.0.0-preview.7.26378.119)
	        - Found 96 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs

Update `Uno.CrossTargetting.targets` to contain a workaround; this
should not be needed in the next .NET 11 release.
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Aug 12, 2026
@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto 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.

ILCompiler version selection now follows the SDK while preserving Android runtime-pack behavior; the deferred RID modernization is out of scope.

@jonathanpeppers
jonathanpeppers merged commit 3744f6b into main Aug 12, 2026
45 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-allow-nativeaot-ilc-divergence branch August 12, 2026 17:32
jonpryor added a commit to unoplatform/uno that referenced this pull request Aug 12, 2026
Context: #22745
Context: dotnet/android#12356

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj -p:UnoTargetFrameworkOverride=net11.0-android -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true -bl
	dotnet build -f net11.0-ios -c Release -p:UnoTargetFrameworkOverride=net11.0-ios -bl src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj

	# Android+NativeAOT
	dotnet publish -f net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -r android-arm64 -p:UnoTargetFrameworkOverride=net11.0-android -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1 -bl

Note: Android+NativeAOT build fails by default, due to a bug in
.NET 11 Preview 7:

	% dotnet publish src/SamplesApp/SamplesApp/SamplesApp.csproj -r android-arm64 -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1 -bl
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1603: Warning As Error: SamplesApp depends on Microsoft.DotNet.ILCompiler (>= 11.0.0-preview.7.26378.119) but Microsoft.DotNet.ILCompiler 11.0.0-preview.7.26378.119 was not found. Microsoft.DotNet.ILCompiler 11.0.0-preview.7.26381.103 was resolved instead.
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-preview.7.26378.119)
	        - Found 21 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-x64 with version (= 11.0.0-preview.7.26378.119)
	        - Found 21 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package runtime.osx-arm64.Microsoft.DotNet.ILCompiler with version (= 11.0.0-preview.7.26378.119)
	        - Found 96 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs

Update `Uno.CrossTargetting.targets` to contain a workaround; this
should not be needed in the next .NET 11 release.
jonpryor added a commit to unoplatform/uno that referenced this pull request Aug 13, 2026
Context: #22745
Context: dotnet/android#12356

Update version numbers accordingly.

To sanity-check locally, try:

	\cp build/ci/net11/_global.json global.json

	dotnet build -f net11.0-ios26.5 src/Uno.Foundation/Uno.Foundation.netcoremobile.csproj
	dotnet build -f net11.0 src/Uno.UI/Uno.UI.csproj
	dotnet publish -f net11.0-android src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj -p:UnoTargetFrameworkOverride=net11.0-android -p:UNO_DISABLE_ANALYZERS_IN_SAMPLES=true -bl
	dotnet build -f net11.0-ios -c Release -p:UnoTargetFrameworkOverride=net11.0-ios -bl src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj

	# Android+NativeAOT
	dotnet publish -f net11.0-android src/SamplesApp/SamplesApp/SamplesApp.csproj -r android-arm64 -p:UnoTargetFrameworkOverride=net11.0-android -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1 -bl

Note: Android+NativeAOT build fails by default, due to a bug in
.NET 11 Preview 7:

	% dotnet publish src/SamplesApp/SamplesApp/SamplesApp.csproj -r android-arm64 -f net11.0-android -p:UnoTargetFrameworkOverride=net11.0-android -p:ApplicationId=uno.platform.samplesapp.skia.nativeaot -p:SkiaPublishAot=true -p:SkiaSharpVersion=4.151.1 -bl
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1603: Warning As Error: SamplesApp depends on Microsoft.DotNet.ILCompiler (>= 11.0.0-preview.7.26378.119) but Microsoft.DotNet.ILCompiler 11.0.0-preview.7.26378.119 was not found. Microsoft.DotNet.ILCompiler 11.0.0-preview.7.26381.103 was resolved instead.
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64 with version (= 11.0.0-preview.7.26378.119)
	        - Found 21 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package Microsoft.NETCore.App.Runtime.NativeAOT.android-x64 with version (= 11.0.0-preview.7.26378.119)
	        - Found 21 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs
	    …/uno/src/SamplesApp/SamplesApp/SamplesApp.csproj : error NU1102:
	      Unable to find package runtime.osx-arm64.Microsoft.DotNet.ILCompiler with version (= 11.0.0-preview.7.26378.119)
	        - Found 96 version(s) in NuGet official package source [ Nearest version: 11.0.0-preview.7.26381.103 ]
	        - Found 0 version(s) in Solution Packages
	        - Found 0 version(s) in …/dotnet-sdk-11.0.100-preview.7.26381.103/library-packs

Update `Uno.CrossTargetting.targets` to contain a workaround; this
should not be needed in the next .NET 11 release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants