Monthly Archives: October 2008

Wix – My perfectly imperfect msi file

Wix is an extremely powerful tool that should help you create installers for almost every conceivable type of setup scenario. It’s not without its flaws though and some of its quirks can result in you wasting a not so inconsiderable amount of time. I’ve listed a few of the items that frustrated me. The solutions over here should hopefully prove helpful to you.

My perfectly behaved yet perfectly useless SAPI installer

I had taken the responsibility of creating an installer for one of the products designed by my firm. As part of the install process, the installer needed to install version 5.1 of Microsoft’s Speech Engine.

Microsoft had played their part and created a set of nifty merge (basically a bunch of .MSM files – if you didn’t know that, you’ve got a long way to go buddy!) modules. What could be simpler than adding the msm files to your wixproject, referencing them and then compiling your shiny new creation?

Well to cut to the chase, my spanking new MSI was created. It appeared to install fine but it didn’t actually seem to install all of the files.

Before this incident, the general impression that I got was that MSIs were more of a “plug-and-play” solution and that one didn’t have to worry about the fine intricacies of what the MSM was doing. Wix changed all that…

After a day of accomplishing almost nothing, I came to the conclusion that Wix did almost certainly not know what to do with the contents of the MSI file beyond installing them. My hunch turned out to be correct.

It seems that Wix needs to be (ahem) “prodded” to perform additional tasks that are contained within the MSM database. It won’t do them unless your application –

a. Performs the same tasks as part of its installation routine. For example, if your wxs/wxi files add registry entries as part of the install routine, then Wix will ensure that any registry entries required by the MSM are carried out at runtime as well.

b. Explicitly “prods” Wix to perform one or more tasks within the InstallExecuteSequence directive.

Once you’ve understood that, all you need to do is to add the following snippets of code to your wxs file

     <RemoveFiles />
     <InstallFiles />
     <WriteRegistryValues />

You might need to add a few additional entries, but I think that the ones given above should suffice. Note that the WIX team does not count this as a bug. They claim that the MSM files have been “improperly” created. Basically it sounds that a lot of inter-office “blame the other party” nonsense, but I don’t have the time nor the mental-bandwidth to care.

PS: Users of Crystal Reports’ MSM modules may face the same problems too. The solution is more or less the same…

– Anand Balaji