Build Settings
- 4 minutes to read
DevExpress .NET MAUI Core package (DevExpress.Maui.Core) includes the following files that can override default project build settings:
- DevExpress.Maui.Core.props
- DevExpress.Maui.Core.targets
This topic describes available settings so you can fine-tune your application’s performance and bundle size.
Mono Interpreter on iOS
Build options UseInterpreter and MtouchInterpreter define how your app is compiled and executed when you target iOS.
Refer to the following Microsoft article for more information on interpreters in .NET MAUI applications: Mono interpreter on iOS.
The following sections describe each option, including their advantages and disadvantages:
UseInterpreter
The UseInterpreter option controls whether an interpreter runs managed code on iOS.
Advantages | Disadvantages |
---|---|
Reduced build time. No need for Ahead-of-Time (AOT) compilation for all code. | Interpreted code generally runs slower than AOT-compiled code. |
Smaller app size. | Battery consumption might be higher compared to AOT-compiled applications. |
Allows for dynamic code compilation (Reflection.Emit ). |
May slow down scrolling operations. |
MtouchInterpreter
The MtouchInterpreter option controls whether to use the Mono interpreter for some or all managed code.
Advantages | Disadvantages |
---|---|
You can selectively use the interpreter for specific parts of your code. | Challenging configuration if you combine AOT with the interpreter. |
Similar to UseInterpreter, the MtouchInterpreter reduces the need for full AOT compilation. | |
Allows for greater use of dynamic features, which are otherwise limited in AOT-only scenarios | |
Allows dynamic code compilation. Because of that, you can use Reflection.Emit and Entity Framework Core. |
LLVM on iOS
The MtouchUseLlvm
option in .NET MAUI enables the Mono LLVM backend for the AOT (Ahead-of-Time) compiler. This option can have a significant impact on the performance and size of your iOS application.
Advantages | Disadvantage |
---|---|
Significant decrease of the application bundle size. | Slow compilation and higher resource consumption during project builds. |
Improves application performance, especially cold startup. | Third-party libraries might not be fully compatible with the LLVM backend. |
Enable LLVM
Set the MtouchUseLlvm
project file’s parameter to true
to enable the Mono LLVM-based compilation:
<MtouchUseLlvm>true</MtouchUseLlvm>
Default Settings
In .NET MAUI applications, default build settings for iOS Debug and Release configurations are different. This section describes settings for .NET MAUI projects that do not reference DevExpress .NET MAUI Controls. If you reference a DevExpress .NET MAUI Control, the DevExpress Build Settings are in effect.
Debug Default Settings
In this configuration, all application code is interpreted.
<MtouchUseLlvm>false</MtouchUseLlvm>
<UseInterpreter>true</UseInterpreter>
<MtouchInterpreter>all</MtouchInterpreter>
Release Default Settings
In this configuration, all application code is compiled in AOT mode. Note that the MtouchInterpreter
setting has no effect.
<MtouchUseLlvm>true</MtouchUseLlvm>
<UseInterpreter>false</UseInterpreter>
<MtouchInterpreter>all</MtouchInterpreter>
Get Your Configuration
Use the following project file’s settings to obtain your application’s configuration:
<Target Name="PrintInfo" BeforeTargets="BeforeBuild">
<Error Text="MtouchUseLlvm=$(MtouchUseLlvm), UseInterpreter=$(UseInterpreter), MtouchInterpreter=$(MtouchInterpreter)"/>
</Target>
DevExpress Build Settings
Package DevExpress.Maui.Core
v24.1 introduces DevExpress.Maui.Core.props and DevExpress.Maui.Core.targets files. These files store build settings that are used when you build your project in the Release configuration. These settings have a higher priority than default settings.
If you use DevExpress .NET MAUI Project Templates to create a project, these files are created automatically.
Note
The following section lists the contents of the DevExpress.Maui.Core.props file. The content is given as an example and can be changed in future releases.
DevExpress.Maui.Core.props File Content
The DevExpress.Maui.Core.props file defines the following settings:
<PropertyGroup>
<DXV>v24.1</DXV>
<DXConfigureTrimming>true</DXConfigureTrimming>
<DevExpress_Data_FileName>DevExpress.Data.$(DXV)</DevExpress_Data_FileName>
<UseInterpreter Condition="$(TargetFramework.Contains('-ios')) AND '$(Configuration)' == 'Release'">true</UseInterpreter>
<MtouchInterpreter Condition="$(TargetFramework.Contains('-ios')) AND '$(Configuration)' == 'Release'">-all,DevExpress.DataAccess.$(DXV),[another DevExpress cross platform libraries]</MtouchInterpreter>
</PropertyGroup>
In the code snippet above, the interpreter is enabled and all libraries (except for DevExpress Cross Platform libraries) are compiled statically. This combination maintains a balance between application performance and bundle size.
You can overload the settings above in your solution’s project file:
<PropertyGroup>
<MtouchInterpreter Condition="$(TargetFramework.Contains('-ios')) AND '$(Configuration)' == 'Release'">all</MtouchInterpreter>
</PropertyGroup>
The code sample above interprets all the libraries referenced in your application. This change optimizes build time and bundle size in the Release configuration, but it can negatively affect application performance.
Assembly Trimming
The DevExpress.Maui.Core.targets file includes the MSBuilt task. Use this task to trim required DevExpress Cross-Platform Libraries. For example, the following code snippet trims DevExpress.Data library:
<Target Name="DXConfigureTrimming" Condition="'$(DXConfigureTrimming)' == 'true'" BeforeTargets="PrepareForILLink">
<ItemGroup>
<ManagedAssemblyToLink Condition="'%(Filename)' == '$(DevExpress_Data_FileName)'">
<IsTrimmable>true</IsTrimmable>
</ManagedAssemblyToLink>
</ItemGroup>
</Target>
You can overload the DXConfigureTrimming parameter value to disable assembly trimming. This parameter affects both Android and iOS build processes:
<PropertyGroup>
<DXConfigureTrimming>false</DXConfigureTrimming>
</PropertyGroup>