WiX performance tip: Use multiple cabinets

If you build setups of almost any size, you can get a “free” boost in build speed on any modern computer – i.e., one with multiple CPU cores. Just use multiple cabinets. Unfortunately, because the CAB API itself isn’t multithreaded, a single cabinet is built with one thread. Light’s multithreadedness kicks in when there are multiple cabinets, so each cabinet is built on one thread.

By default, Light uses the number of processors/cores in the system as the number of threads to use when creating cabinets. You can override the default using Light’s –ct switch or the CabinetCreationThreadCount property in a .wixproj project.

Multiple threads will make good use of your available CPU power but with more threads loading files and writing cabinets, sooner or later, you’ll reach a point where your disks will be thrashing or just be unable to keep up with a nice dual quad-core build server. You can experiment with CabinetCreationThreadCount, RAID 0, the WIX_TEMP environment variable, or simply writing the output package (and therefore its cabinets) to a separate drive.

You can use multiple cabinets both externally and embedded in the .msi package (using the Media/@EmbedCab attribute).