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.
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>
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.