Tuesday, August 21, 2007

No half installs. Sometimes...

One of the big reasons to use MSI-based installers, as the story goes, is that the entire install is handled inside a transaction.  Either the entire install succeeds or fails as a unit.  This prevents an installer from failing halfway through and leaving the product half-installed.  Well, no.  Not quite.

Recently I was testing a small change to our WiX-authored installer.  The change caused the installer to fail and the installer dutifully rolled back and declared that no changes had been made to my system.  One of the things that the installer was supposed to do was register a .NET assembly in the GAC and then run installutil on the assembly to execute it's Installer-based classes.  It was this installutil step that failed.

I made sure that the assembly that was headed to the GAC was not already registered before running the installer.  Guess what I found after the installer failed and notified me that 'no changes had been made to my system'?  Yup.  There was my assembly registered in the GAC. 

I asked about this on some lists and found out that MSI-based GAC installation happens after the InstallFinalize option and is therefore not part of the transaction.  Hmmm.  That's all well and good but when the installer clearly tells me that my system has not been changed, I would like to trust it.

Just another example of what we want not matching what happens, here in Microsoft world.  :)

*UPDATE*

Turns out this was caused by a problem in my WiX code.  I had mistakenly scheduled my CustomAction to execute after InstallFinalize.  Anything that happens after the install is finalized will most certainly not be rolled back. 

No comments:

Post a Comment