maui: Upgrading to .NET 9 cause build time too long

Description

In .NET 8 build takes around 5 minutes After i upgrade to .NET 9 it takes around 20-25 minutes

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.10 SR1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.10 SR1

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output


About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 26 (4 by maintainers)

Most upvoted comments

Same here… debug build happens in seconds but release builds or publishing is well see for yourself: Image this one took 55 minutes. 54 of which was in the AOT compile stage. Has anyone found a workaround?

I had a similar issue for release builds, but was made worse by publishing symbols to Google with “FirebaseCrashlyticsUploadSymbolsEnabled”.

Using the <MtouchLink>SdkOnly</MtouchLink> brought my builds back to pre .net 9 times, maybe it will help you too.

Not planned? The iOS publish is very slow; it takes 2 hours since the migration to .NET 9.

We are still having this issue as well. And with azure devops having limited apple resources our builds keep hitting the 60 minute max time that azure allows a build job to run and get cancelled. As a result I am having to manually build and deploy which takes right at 30 min if I do the build on an M4 mac. I am sure even Azure would like a solution to this as it is just burning cpu time only to get cancelled anyway. My build used to take 6 min on azure.

Image

It took me 18 minutes to build an APK file in Debug mode. How can I disable building APK In Debug mode?

I tried this configuration, but it didn’t help

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
        <SkipApkEmbed>true</SkipApkEmbed>
    </PropertyGroup>

    <!-- Override the _BuildApkEmbed target when SkipApkEmbed is true -->
    <Target Name="_BuildApkEmbed" Condition="'$(SkipApkEmbed)'=='true'" DependsOnTargets="">
        <Message Text="Skipping _BuildApkEmbed in Debug mode." Importance="high" />
    </Target>

UPD: this configuration helped me to decrease the build time to 2 minutes

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
        <AndroidUseSharedRuntime>true</AndroidUseSharedRuntime>
        <EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
        <AndroidPackageType>Debug</AndroidPackageType>
    </PropertyGroup>

I turned off llvm on the release builds and I am back down to 2 min builds.

/p:MtouchUseLlvm=false

<MtouchUseLlvm>false</MtouchUseLlvm>