1

I have a .net core(worker service) application and created its msi using Wix installer. Currently the size of msi is 26 MB. I need to reduce the msi size as low as possible in order to be downloaded from a web application. I tried
<MediaTemplate CompressionLevel="high" /> But i got reduced the msi by 4 MB only(msi size:22 MB).Is there any other solution for this

Also tried publishing by 'Framework-Dependent' for main project.So the msi size decreased to 600 KB.But showing user privilege issue for starting service on installation.While changing to 'self-contained' publish the msi size is 26 MB and installing successfully. So how to avoid the issue while using 'framework-dependent' deployment?

David
  • 380
  • 2
  • 14
  • I guess the first question that comes to mind is what you are including in the MSI? Is it even an MSI or a Burn bundle setup.exe? [Are you including the .NET runtime](https://learn.microsoft.com/en-us/dotnet/core/deploying/)? (I don't use .NET Core yet). Beyond **`1)`** *`compression`* you can also generally **`2)`** *`put some resource files online`* (images, templates, whatever you need) and you can also **`3)`** *`download certain runtimes via a setup.exe`* bootstrapper if they are needed. – Stein Åsmul Aug 09 '20 at 20:49
  • [How to check that .NET Core is already installed](https://learn.microsoft.com/en-us/dotnet/core/install/how-to-detect-installed-versions). – Stein Åsmul Aug 09 '20 at 20:54
  • Try to compress the files you plan to deploy by the installer using 7-zip. if results are significantly better, you can have the MSI deploy a .7z file and extract it. – yossiz74 Aug 10 '20 at 04:56
  • For the compression experts: [the various compression techniques in MSI files](https://stackoverflow.com/a/6313772/129130). Not sure what 7-zip uses, but it appears the highest level of compression in MSI files uses LZX compression (LZ77-based compression technique using *static Huffman encoding*). Haven't checked what Burn bundles use. – Stein Åsmul Aug 10 '20 at 09:12

1 Answers1

0

CAB compression doesn't get any better than "high". Compression technologies have greatly improved over the years, but cabinet.dll on which Windows Installer relies has not.

The .NET Framework itself used to actually leave files uncompressed, then 7-zip the entirety of the install. To do that,

  1. Define a single Media element with no compression attributes set.
  2. Set Package/@Compressed="no".
  3. After your product is built, you can use 7-zip to ZIP up everything and get much better compression.

If even that is too big, you might instead consider running your app on a shared install of .NET Core, and use Burn to chain the version of .NET Core you want. With the right detection logic, the package for .NET Core won't even be downloaded if already installed and you have it as a separate package (i.e. don't embed all packages into your installer; leave them as loose files to be downloaded from some end point).

Heath
  • 2,986
  • 18
  • 21