Skip to Content
Author's profile photo Former Member

Uninstall a component during a minor upgrade

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. This happened more than once with the Mobile Installation. We need to remove that library in the latest release.” We as a Windows Installer developers 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.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi, I know this post is a decade old so not sure if you are still active. But I have few doubts. I am trying to rename a service using minor upgrade so uninstalling the old one and installing the new one with new GUIDs. This falls into this post's category. Here are my doubts:


      1. This condition is fine on a component:  <?define Deprecated="TRUE"?> <Condition>$Deprecated</Condition>
      2. Will I need ServiceInstall Element or just ServiceControl as mentioned is fine? I removed ServiceInstall tag
      3. if for some components, the file is a keypath, then whats the difference in condition?
      4. How do you remove components with config liek if they are using util: Xml element? Just set action = delete?
      Author's profile photo Sajid Amir
      Sajid Amir

      Hello Akshita,

      please only use alert moderator for reasons as described in our rules of engagement: