Enable Trimming to Reduce MAUI App Size
- 2 minutes to read
This article includes guidelines on reducing the size of a MAUI app.
Remove Unused NuGet Packages
Our NuGet packages reference native assemblies/resources. Since these native parts are compiled into the app bundle when you reference a NuGet package even if you do not use it, we recommend that you remove all unused DevExpress MAUI NuGet packages to reduce the deployment size of your app.
Trim DevExpress.Data Package
If you use DevExpress MAUI controls in your application, trim operations for the DevExpress.Data library are enabled out-of-the-box. To avoid unexpected runtime exceptions, we recommend that you disable the trim feature for this package in the following cases:
- You use other libraries that reference DevExpress.Data.
- You use DevExpress.Data APIs directly in code.
The following code snippet disables DevExpress.Data trimming:
<PropertyGroup>
<DXConfigureTrimming>false</DXConfigureTrimming>
</PropertyGroup>
When you modify project settings, delete the bin and obj folders before you rebuild the application.
Enable Mono Interpreter (iOS Only)
You can enable the Mono Interpreter to significantly reduce the build time and the size of your iOS application.
This setting disables AOT compilation for .NET libraries. This configuration may affect performance, especially during application startup. However, the impact on performance depends on the application and may be negligible in many cases.
The following code snippet enables the mono interpreter:
<PropertyGroup>
...
<MtouchInterpreter Condition="$(TargetFramework.Contains('-ios'))">all</MtouchInterpreter>
</PropertyGroup>
When you modify project settings, delete the bin and obj folders before you rebuild the application.
Refer to the following topic for more information on build settings: Build Settings.