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.
- Consider the component abc.dll which has to be
removed.
- 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.
- Replace abc.dll file with a zero byte file with
the same name.
- 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'.
- 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.