For Blazor WebAssembly we are using these settings for faster runtime as well as "fixing" a memory allocation issue on lower end devices:
<RunAOTCompilation Condition="'$(Configuration)'=='Release'">true</RunAOTCompilation>
<EmccTotalMemory Condition="'$(Configuration)'=='Release'">134217728</EmccTotalMemory>
Now we are using much of the same code in the Blazor Hybrid MAUI app. However, when adding these two settings to the csproj of the MAUI app the compiled output is still the same size (and compilation time same). Which made me wonder does it even make sense to run AOT on MAUI at all? If yes, is it a good idea? Using .NET 8 p6.
Maui Blazor isn't running in a browser; it isn't compiling to WebAssembly.
AFAIK, those settings have no meaning except for WebAssembly.
Maui produces a .Net app, on each platform. The app's assembly contains "IL" code.
By default, that IL code is JIT-compiled to native cpu as the app runs.
.Net 7 (or later) has its own AOT deployment.
This is only supported for Windows and Linux. (Ignored for other platforms.)
In .csproj:
<PropertyGroup>
<PublishAot>true</PublishAot>
</PropertyGroup>
Must use a command line to built the AOT-compiled assembly.
for Windows:
dotnet publish -r win-x64 -c Release
for Linux:
dotnet publish -r linux-arm64 -c Release
Read the document linked above, for further important details.