If a file is present in a Baseline package then removed in the Upgrade package, it is not trivial to get the installer to remove the file in a way that uninstalling the patch will put it back.
Important!!! MUST READ
Before removing a file you need to make sure you have no other options. The only time you should remove a file using a patch is when the mere presence of the file causes problems. Consider removing references to the file from files that use it or patching it to be an "empty" file. Removing a file should be a last resort.
For shared files, removing a file with a patch could mean breaking any other product using that file. The removal of the file does not take reference counting into account when determining to remove a file. It will be removed if you tell it to be removed. Make sure you consider everything that uses or could use the file before removing it.
If a file must be removed by a patch there are a few options:
If the file is not a the keypath of its component:
- Remove the file from the component- Add a RemoveFile entry to the component.
- Remove the file from the component- Add a RemoveFile entry to the component.
If the file is the keypath if its component:
If the file is the keypath, it means this file is the identity of the component. In this case the entire component must be removed. You cannot simply remove a component using a patch. If you do, you have to remove the entire feature which is not usually the desired scenario. If it is, then just remove the feature from your patch.
In order to remove a component without removing its feature you need to convince Windows Installer that the component isnt supposed to be installed but the msi database still needs to know about it. You can achieve this by making the component's condition false. In order to cause a recalcalculation of the component during repair/patch you also need to mark the component as transitive. The side-affect of this is that when the patch is uninstalled, the file is not put back on the machine. This is because when the patch is removed, the component is no longer transitive and its condition is not reevaluated. You can solve this by shipping two patches. One that marks the component as transitive and a second that makes the component's condition false.
Example:
<Component Id="Foo" Transitive="yes" ... >
<Condition>FALSE</Condition> ...
</Component>
<Component Id="Foo" Transitive="yes" ... >
<Condition>FALSE</Condition> ...
</Component>
Notes and considerations:
In any case, uninstalling the patch may prompt for source if the file that needs to be put back is not available to the installer.
If building 2 patches for the transitive solution, you cannot base the two patches off of the same build because both changes are made to a single component which is the smallest level at which patches can be filtered.