Trim down the size of the compiled binary #9217
Replies: 4 comments 15 replies
-
Avalonia assemblies don't add too much of size (except of Fluent theme because it contains fonts). SkiaSharp though eats almost 10mb unzipped. Baseline:
Produces 58.2 MB unzipped and 25 MB zipped for the minimal app. With more XAML views it will grow a little. Majority of additional size will be added by third party dependencies. Next, if I make it a single file:
50.8 MB unzipped, 22 MB zipped. Next, if I allow "link" trimming:
37.4 MB unzipped, 16.1 MB zipped. Last step is something that should be improved on Avalonia side, so developers won't need to apply additional configuration. Also, I can't confirm if it perfectly works with Avalonia 0.10 (test app is running though), more work was done for Avalonia 11.0. |
Beta Was this translation helpful? Give feedback.
-
As a tip to reduce the size even more, developers can employ a couple of more options. This is most helpful when debugging with tools such as VS Linux Debugger where the payload deployed is your
To apply, update your <PropertyGroup>
<!-- Reduce Build Resources -->
<!-- Supported languages https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#satelliteresourcelanguages -->
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<!-- Supported runtimes (https://learn.microsoft.com/en-us/dotnet/core/rid-catalog) -->
<RuntimeIdentifiers>win10-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup> UPDATE:
|
Beta Was this translation helpful? Give feedback.
-
Hi, I think this is rather trivial in terms of overall size, but just in case: So I was just wondering if it should be possible for these to be trimmed out on a Windows only build? |
Beta Was this translation helpful? Give feedback.
-
From @maxkatz6 helpful info if you can't publish from command line (like with msix, etc.) you can add this to your target
Reduced my installer from 45mb to 15mb! 😎 |
Beta Was this translation helpful? Give feedback.
-
Are there any ways to reduce the compiled binary size? For now, the compiled binary size is around 60~80 MB. Which is really large. Are there any plans in the future version to consider to reduce the binary size of the Avalonia build?
Beta Was this translation helpful? Give feedback.
All reactions