Skip to content

[msbuild] Cached AOT compiler path not always invalidated after .NET upgrade #25481

@jifryk

Description

@jifryk

Description

replacing issue# 35446 in the hopes of getting more attention on this issue


Similar to issue# 20918, or maybe issue# 17340, BUT 20918 doesn't seem to have a final resolution, and the ILLink package ref'd in 17340 solution is not included in our project.

We published our maui app to Google Play and Apple App stores back in December, now we're looking to do an update.

When building for iOS, we built our new code using the same environment used for December build just fine, but when we tried to upload to TestFlight, we ran into the updated requirement where we must now build with iOS 26 SDK (we were using iOS 18.5 SDK); we upgraded to XCode 26 and have iOS 26.2 platform available.

Now, when we try to build for iOS we get the following error:

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net9.0_26.2/26.2.9008/targets/Xamarin.Shared.Sdk.targets(1387,3): error MSB4018: 
      The "AOTCompile" task failed unexpectedly.
System.AggregateException: One or more errors occurred. (One or more errors occurred. (One or more errors occurre
      d. (An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.os
      x-arm64.Cross.ios-arm64/9.0.9/Sdk/../tools/mono-aot-cross' with working directory '/Users/xinjundong/Documents/is
      can-mobile/Apps/IScanBT'. No such file or directory)))

...indeed, the ref'd 9.0.9 version is not installed, we have 9.0.15 instead.

Need some guidance on (presumably) changing some config file or parameter to point to the correct version, or some other workaround for this issue.


What we tried:

  • cleared NuGet cache- still fails
  • set PublishAOT = false in csproj- still fails
  • search for 9.0.9 refs in project and platform build artifacts- not found
  • copied 9.0.15 version to 9.0.9 path ref'd in error message; the build completes but we're getting weird layout issues that we don't see in the equivalent Android build from the same source (this is obviously extremely hacky- I didn't expect the build to work and not surprised the runtime has issues)

re regression question below- it arguably is or is not a regression, depending on your perspective (thus the conflicting answer x2), but I assume it's really just a config issue

Steps to Reproduce

  1. Have an existing working app and working iOS build process utilizing XCode + iOS 18.5 SDK
  2. Upgrade to XCode 26 + iOS 26.2 SDK
  3. Attempt to build with dotnet cli
  4. The build fails with error ref'ing /dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.os
    x-arm64.Cross.ios-arm64/9.0.9/ path, we have */9.0.15/ instead

Link to public reproduction project repository

No response

Version with bug

9.0.100 SR10

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI, No, this is something new

Last version that worked well

9.0.100 SR10

Affected platforms

iOS

Affected platform versions

iOS 26.2 SDK (build error after upgrading XCode + iOS from 18.5 SDK, which worked fine); dotnet workload list refs Manifest Version=9.0.120/9.0.100 & Installation Source=SDK 9.0.300 for both Android & iOS

Did you find any workaround?

No

Relevant log output

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net9.0_26.2/26.2.9008/targets/Xamarin.Shared.Sdk.targets(1387,3): error MSB4018: 
      The "AOTCompile" task failed unexpectedly.
System.AggregateException: One or more errors occurred. (One or more errors occurred. (One or more errors occurred. (An error occurred trying to start process '/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.ios-arm64/9.0.9/Sdk/../tools/mono-aot-cross' with working directory '/Users/xinjundong/Documents/iscan-mobile/Apps/IScanBT'. No such file or directory)))

## ...indeed, the ref'd 9.0.9 version is not installed, we have 9.0.15 instead. ##

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fixmsbuildIssues affecting our msbuild tasks/targets

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions