Derek Cicerone Installing...

WiX, Setup, and trying to make it all easy, not just easier

Friday, April 21, 2006

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: on the command line. For instance, to suppress ICE33, you would pass -sice:ICE33.

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:
Where do ICEs come from?
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".

7 Comments:

At Friday, April 21, 2006 3:44:00 PM, Anonymous Bob Arnson said...

The Windows Vista Logo Program v0.8 says:

Windows Installation packages must not receive any errors from the Internal Consistency Evaluators (ICEs) listed here:

1-31, 33-36, 38-57, 59, 61-63, 65, 67-72, 74-84, 86-87, 89-94, 96-99

Having it in WiX is a nice freebie!

Hopefully they'll relax the ICE33 requirement.

 
At Friday, April 21, 2006 3:49:00 PM, Blogger Derek Cicerone said...

Fortunately, ICE33 only posts warnings, so disabling that ICE should not affect a product's ability to pass Logo requirements.

 
At Friday, April 21, 2006 5:14:00 PM, Anonymous cs said...

Is this smoke tool the same one that Michael Sanford made?

 
At Friday, April 21, 2006 5:26:00 PM, Blogger Derek Cicerone said...

Smoke is basically just a stand-alone version of the MSI validation functionality which I added to Light. It is not related to any other smoke tools.

 
At Tuesday, April 25, 2006 7:06:00 AM, Anonymous Anonymous said...

I see the WiX source tree now includes the Microsoft CUB files. Under what terms may these files be further copied, distributed, and/or modified? AFAIK, Microsoft only distributes these as part of MSIVAL2 and Orca, and the license agreements for those programs don't even allow using them in multiple computers.

 
At Thursday, August 31, 2006 3:43:00 AM, Anonymous Graeme said...

We're currently using Michael Sanford's smoke.exe - where can I find yours? It doesn't seem to be included in the WiX 2.0 distribution.

 
At Thursday, August 31, 2006 10:14:00 AM, Blogger Derek Cicerone said...

Smoke is available only in WiX 3.0.

 

Post a Comment

<< Home