Geeks With Blogs
Adventures of a Setup Developer my musings about setups and other things in my life
It is bound to happen. You will have a developer come up to you one day and say, "Remember the DLL file that we shipped in the previous release, we have consolidated its functionality into the core library. We need to remove that library in the latest release." You as a Windows Installer developer would then be frustrated after finding out that you cannot remove components during a minor upgrade and you will have to manage with all the ugliness of a major upgrade.  I will write about the ugliness of a major upgrade in some other blog.

So if you really have to remove the DLL, you need not have to go through the trouble of major upgrade. We can actually uninstall components during a minor upgrade. But the catch is that you should not remove the component from the existing MSI. My colleague Kajal Biswas calls this process as "Puncturing the component". Let me detail the process of puncturing the component.
  1. Consider the component abc.dll which has to be removed. 
  2. Collect the Registry, CLSID and the COM information if you have dynamically acquired them, you will have to fill them in manually later. This is usually the reason why I do not use COM Extract at Build. I usually use 'Extract COM Information' feature of InstallShield DevStudio. This would ensure that I can find out the exact registry entries and COM Settings.  If you had used the WiX Toolset, it is pretty straight forward. You will just have to go to the next step and you can ignore this completely.
  3. Replace abc.dll file with a zero byte file with the same name.
  4. Set the transitive bit of the component. If you are using InstallShield DevStudio, simply set the 'Reevaluate Condition' field in the component property to 'Yes'. 
  5. Replace any existing condition on the component with a condition that evaluates to false. As a habit, I and my colleagues enter the paradoxical '1=0' as the component condition. You can also enter something meaningful like 'GoToHell=666' or something like that.
During a minor upgrade, if the feature associated with the component is reinstalled, the trasitive bit with also force the state of the component to be reevaluated. And since the component is present and the condition is false, the component will be uninstalled during a minor upgrade. It is hack. But it works. Posted on Sunday, June 11, 2006 6:42 AM Setup | Back to top

Comments on this post: Uninstall a component during minor upgrade

# re: Uninstall a component during minor upgrade
Requesting Gravatar...
Very useful tip... Thanks :)
Left by Ajith on Jun 12, 2006 1:36 PM

# re: Uninstall a component during minor upgrade
Requesting Gravatar...
Thanks...Superb tip :)
Left by Kavitha on Jul 18, 2007 11:46 AM

# re: Uninstall a component during minor upgrade
Requesting Gravatar...
Thanks...nice helps a lot... :-)
Left by Prakash MN on Jul 30, 2008 1:58 AM

# re: Uninstall a component during minor upgrade
Requesting Gravatar...
Nice approach! an innovative one.
Left by puram on Oct 27, 2009 2:39 AM

# re: Uninstall a component during minor upgrade
Requesting Gravatar...
I'm using InstallShield 2008/2010. I have a feature that includes merge modules (for the Crystal Runtime). The feature includes the merge modules directly (no component), so I can't set the transitive bit or the condition. I want to remove the Crystal Runtime during a minor upgrade. It looks like I'm just out of luck because a Feature cannot be removed. Any other thoughts...I would love to avoid a Major Upgrade.
Left by Mark on Nov 05, 2010 4:25 PM

Your comment:
 (will show your gravatar)

Copyright © Vagmi Mudumbai | Powered by: