We're using the firewall extension to add firewall exceptions during the installation of our application:
<DirectoryRef Id="APPLICATIONFOLDER">
<Component Id="cmp_FirewalRules" Guid="{xx}" KeyPath="yes">
<fw:FirewallException Id="xx" Name="xx" Port="123" Protocol="tcp" Scope="any" Profile="all" IgnoreFailure="yes" />
</Component>
</DirectoryRef>
Every package is a MajorUpgrade with Schedule="afterInstallInitialize".
Our problem is that the firewall rules are removed and created from scratch when an update is installed. So if for some reason the user decided to deactivate the firewall rule, it will be activated again after an update is installed.
It might be that Schedule="afterInstallExecute" avoids this problem. However this is not really an option.
Is there any way to prevent the firewall rules from being removed and created from scratch in the case of a reinstall?
I realize that this is a variation on a common WiX question. We've overcome similar problems for desktop shortcuts and Windows Service settings, but not for firewall rules.
What I tried:
- I tried to use an empty GUID, this does not work, the rule is still overwritten. Worse, it's not removed during uninstall (as expected).
- I tried various conditions on the component but realized that they are of no relevance during the uninstall that happens in the case of a major upgrade.
We had the same problem with keeping the Windows Service configuration in case of a major upgrade. This was solved by disabling DeleteServices in the InstallExecuteSequence in case of a reinstall (like here). Maybe there is something similar for firewall rules, but I did not manage to find it.
Any suggestions?