MSI Validation in WiX
One of the most frequently overlooked steps in building a Windows Installer setup is validation. Validation is very important; it finds all sorts of problems with per-user installations, collisions between installed files, and other common authoring mistakes that are hard to catch until the complete MSI or MSM file is built. Often, when debugging a setup problem, I've found that just running validation would quickly find the mistake(s).
Ok, so if validation is so important, why doesn't everyone run it? There's a few reasons: some people simply aren't aware of MSI validation, others are lazy, and the grand majority of people simply just forget because its an optional step.
With WiX 3.0, running validation is now easier than ever because its integrated directly into Light.exe. Just keep using the WiX tools like you always have in the past. If Light finds any validation problems while linking your MSI or MSM file, it will simply display a warning or error message. It's really that simple. Best of all, Light will even display source line information about where an ICE error or warning came from when it's available.
With the addition of the validation infrastructure to Light in WiX 3.0, we thought it would also be useful for the users of WiX 2.0 and other installation creation programs to have a simple way to run validation on their MSI or MSM files from the command line. So, we're also releasing a new tool called Smoke which can run validation on any MSI or MSM file and reports errors and warnings in the same convenient command-line format as the other WiX tools.
What if I don't want to run validation?
If you would like to suppress validation, simply supply the option -sval to light.exe. However, this is strongly discouraged since it means that you won't automatically get validation coverage on your setup.
Can I suppress an individual Internal Consistency Evaluator (ICE)?
Absolutely, just pass -sice:
Are there any downsides to running validation in Light?
Yes, running validation will make your builds a bit slower. However, due to the benefits, the time spent validating is a very good trade-off in comparision to time wasted debugging issues that could have been caught simply by keeping validation on.
Do I really need to run validation?
Running validation is a very important step in insuring that you are creating a quality setup experience for your users. With this new validation feature, we were finally able to test our own MSI packages and we were shocked at the number of issues it found (since we'd like to consider ourselves somewhat experts in the setup area). This resulted in several improvements to Candle and some of the extensions, but even with these improvements, we'll never be able to guarantee the coverage provided by simply running validation.
Is there any documention on validation from the Windows Installer team?
There are several good articles on MSDN about using validation:
- Internal Consisteny Evaluators
- ICE Reference - very useful for finding out what a particular ICE does
- Merge Module ICE Reference - for finding out about merge module ICEs
ICEs are nothing more than custom actions which run against a database and display warnings and errors based on what they find. Since they are merely custom actions, they are not surprisingly packaged into special Windows Installer database files with a .cub extension. The extension may seem a bit arbitrary until you learn one vital piece of information: the true extension of these files is "cube" - "cub" is merely an 8.3 compliant name. It's a play on words because the tests are called ICEs (ice cubes - get it?).
The Windows Installer team distributes several cube files. The two most notable files are darice.cub and mergemod.cub. These cube files contain, respectively, the ICEs for MSI and MSM files.
Which ICEs will WiX run against my MSI or MSM file?
For MSI files, WiX will run all the ICE tests found in darice.cub. For MSM files, WiX runs mergemod.cub. Please note that ICE33 has been disabled by default because it forces authors to use the advertised COM tables instead of normal registry keys whenever possible. Due to problems with using advertised COM registration in certain scenarios (like repair), the WiX team does not suggest this practice and thus has disabled the ICE by default.
How does WiX run validation?
WiX uses the method outlined here. Basically, Light takes your MSI file, merges a .cub file into it, registers an external UI handler (like its going to run an installation), and then runs the custom action sequence found in the _ICESequence table (ignoring the ICEs you chose to suppress of course).
So, if an ICE is nothing more than a custom action, can I make my own?
You can create your own ICE custom action and package it into a cube file, just like the standard cube files. However, at this time, Light and Smoke do not support passing custom cube files into the validation engine. If you would like this feature to be added, please open a request on SourceForge.
Why is Smoke called "Smoke"?
It's another play on words. Because the smoke program essentially tests an MSI or MSM file for problems, its like a "smoke test".