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

Chuck Bohling 346 Reputation points
2020-04-20T22:02:07.5+00:00

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?

Universal Windows Platform (UWP)
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,675 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Lex Li (Microsoft) 4,742 Reputation points Microsoft Employee
    2020-05-25T01:23:50.087+00:00

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

    https://learn.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.

    0 comments No comments