Skip to Content

New WiX feature: DefaultCompressionLevel

Working with multigigabyte setups has taught me that compressing cabinets can be very time-consuming. Of course, it can also be vital – Flight Simulator X barely fit on two DVDs; without high compression, it would have required a third disc.

As I work on the WiX tooling and authoring for upcoming products, I knew I needed to support multiple compression levels: no/low compression for developer builds, “normal” MSZip compression for daily builds, and high compression for milestone builds.

By default, a Media element with no CompressionLevel attribute gets MSZip compression, which offers a nice compression-to-time ratio. A typical approach to control compression level outside the authoring is to pass in a preprocessor variable via the MSBuild project and use its value in Media/@CompressionLevel. That works but is kind of clunky.

So I decided to address the clunkiness by adding support to override the default MSZip compression level. Here are the two steps to take advantage of this feature:

  1. Author Media elements with a Cabinet attribute but without a CompressionLevel attribute.

  2. Pass -dcl:level on the Light command line, where level is none, low, medium, high, or mszip.

    – or –

Declare the DefaultCompressionLevel property in your MSBuild project file, with a value of _none_, _low_, _medium_, _high_, or _mszip_.

There are no changes in behavior with existing authoring or build scripts. If you omit Media/@CompressionLevel and don’t use -dcl or DefaultCompressionLevel, you’ll continue to get MSZip compression.

This change will appear in the next weekly release of WiX v3.