[NativeAOT] Let SDK select ILCompiler version - #12356
Conversation
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
There was a problem hiding this comment.
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
KnownILCompilerPackmetadata update that pinnedMicrosoft.DotNet.ILCompilerto$(MicrosoftNETCoreAppRefPackageVersion). - Kept existing NativeAOT runtime-pack selection logic intact (still setting
LatestRuntimeFrameworkVersionfor the NativeAOT-labeledMicrosoft.NETCore.Appruntime pack).
| <KnownRuntimePack Include="@(_AndroidNetCoreAppNativeAotKnownRuntimePack)"> | ||
| <LatestRuntimeFrameworkVersion>$(MicrosoftNETCoreAppRefPackageVersion)</LatestRuntimeFrameworkVersion> | ||
| <RuntimePackRuntimeIdentifiers>%(RuntimePackRuntimeIdentifiers);android-arm</RuntimePackRuntimeIdentifiers> | ||
| </KnownRuntimePack> |
There was a problem hiding this comment.
this also seems like it might cause issues, KnownRuntimePack should have android-arm for nativeaot now
There was a problem hiding this comment.
hm actually, looks like it's not in sdk yet...
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.
|
@dalexsoto review |
dalexsoto
left a comment
There was a problem hiding this comment.
ILCompiler version selection now follows the SDK while preserving Android runtime-pack behavior; the deferred RID modernization is out of scope.
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.
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.
Summary
The Android workload currently pins
Microsoft.DotNet.ILCompilerto 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.