Skip to content

Remove NativeAOT runtime-pack override after dotnet/sdk#55750 ships #12362

Description

@jonathanpeppers

Android framework version

net11.0-android (Preview)

Affected platform version

.NET 11 SDK containing dotnet/sdk#55750

Description

Microsoft.Android.Sdk.NativeAOT.targets currently rewrites the .NET SDK's KnownRuntimePack metadata for Microsoft.NETCore.App NativeAOT packs. It pins LatestRuntimeFrameworkVersion and appends android-arm to RuntimePackRuntimeIdentifiers.

This was added as an Android-side workaround because the .NET SDK did not advertise android-arm for the NativeAOT runtime pack. dotnet/sdk#55750 adds that RID to the SDK's built-in KnownRuntimePack metadata.

Once dotnet/sdk#55750 is merged and available in the SDK used by this repository, remove the workaround from src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets:

<!-- Outer restores use RuntimeIdentifiers; RuntimeIdentifier is only set in per-RID inner builds. -->
<ItemGroup>
  <_AndroidNetCoreAppNativeAotKnownRuntimePack Include="@(KnownRuntimePack->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('RuntimePackLabels', 'NativeAOT'))" />
  <KnownRuntimePack Remove="@(_AndroidNetCoreAppNativeAotKnownRuntimePack)" />
  <KnownRuntimePack Include="@(_AndroidNetCoreAppNativeAotKnownRuntimePack)">
    <LatestRuntimeFrameworkVersion>$(MicrosoftNETCoreAppRefPackageVersion)</LatestRuntimeFrameworkVersion>
    <RuntimePackRuntimeIdentifiers>%(RuntimePackRuntimeIdentifiers);android-arm</RuntimePackRuntimeIdentifiers>
  </KnownRuntimePack>
</ItemGroup>

Context: #12356 (comment)

Steps to Reproduce

  1. Wait for Add android-arm to NativeAOT runtime pack RIDs sdk#55750 to merge and flow into the .NET SDK consumed by dotnet/android.
  2. Remove the Android-side KnownRuntimePack override above.
  3. Restore a NativeAOT Android project with RuntimeIdentifiers=android-arm.
  4. Verify project.assets.json selects Microsoft.NETCore.App.Runtime.NativeAOT.android-arm and does not fall back to Microsoft.NETCore.App.Runtime.NativeAOT.linux-bionic-arm.

Did you find any workaround?

Keep the existing Android-side override until the updated SDK is available.

Relevant log output

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions