question

ChuckBohling-9818 avatar image
0 Votes"
ChuckBohling-9818 asked ·

How to reduce the size of a MSIX .Net Core 3.1 installation?

I have a WPF/.Net Core 3.1 app that I'm packaging as an MSIX for submission to the Store. If I publish the app as a sideloading .msixbundle then install it, the resulting directory is WindowsApps is huge. I assume that's all of .Net Core. But most of the .dlls I don't use. I can delete them for the directory and the app runs fine. Is there a way to reduce the size of the installation?

As a test, I created a default WPF/Core 3.1 app and a MSIX packaging project. No additional code was added. I then built, published and installed the app. The WindowsApps directory contained 499 files and was 136MB. I briefly looked at dotnet /p:TrimUnusedDependencies but it really did't seem to help much.

So, any way to reduce the size of the installation?

windows-wpfwindows-desktop-bridge
· 7
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Currently, there is no direct method to reduce the size of the installation. Maybe you can put some resources from your app on your server and then download them after installation or use smaller images in your app.

0 Votes 0 ·

Thanks for your answer. I understand the intention that an app comes self-contained but with potentially dozens of Core apps, a lot of disk space will be taken up by duplicate files.


0 Votes 0 ·

As I said, it's better not to put resource files in the app(e.g. video files, etc). You can put them from your app on your server and then download them after installation or use smaller images. In addition, I'm confused about your duplicate files, what are you specifically referring to?

0 Votes 0 ·

When you publish a side-loading MSIX project then install it, the resulting directory in WindowsApps is like 135 MB. Most of the files are Core 3.1 .dll's. If other 3.1 apps do the same thing, they too will have 135 MB of 3.1 dll's. Most of the .dll's will be duplicates. That's correct right?


0 Votes 0 ·

I created .msixbundle and installed the app, after that I didn't find the Core 3.1 .dll in the WindowsApps directory, can you show us how you packaged your app as an MSIX? In addition, did you install the Core 3.1 SDK in your current environment?

0 Votes 0 ·

I'm not sure if what gets installed is Core 3.1 or not. But what does get installed are a lot of dll's. For example:


api-ms-win-core-console-l1-1-0.dll


coreclr.dll


System.dll


SystemCore.dll


System.Threading.dll


Here's the full list: 8093-installedfiles.txt


I did a clean install of VS2019 and used .NET desktop and UWP workloads. Nothing else. I then created a default WPF C# project and a default MSIX project. Rebuilt and published a sideloading, release version. Then installed it. The app installation directory in WindowsApp has 291 entries, 13 of which are language directories. Total size was 136MB. This should be easy to repro. Is this correct? If so, every app that does the same thing I just did will have the same installation footprint, correct? Am I missing an option to prevent this? Is this just because it was sideloaded?


0 Votes 0 ·
installedfiles.txt (19.5 KiB)

Yeap, each package will contain these same dlls. Currently, did't find any method to prevent this.

0 Votes 0 ·
ChuckBohling-9818 avatar image
0 Votes"
ChuckBohling-9818 answered ·

Ok, thanks

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

lextm avatar image
0 Votes"
lextm answered ·

Starting from .NET Core 3.0 you can trim out what your app doesn't use,

https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#assembly-linking

However, that won't reduce too much from the final package as .NET Core WPF runtime is still large.

You might also consider generating a single file like that article talks about.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.