I am wondering if it is possible to manually launch the RemoveFolderEx element from a custom action. I guess maybe not, but someone might know a way that I don't know about.
My problem is that I want to run the RemoveFolderEx element, but only in true UNINSTALL, but my program executes it when updating, since I installed it to remove before reinstalling.
I tried this with this Wix method
: the state does not work
however it did not work and still worked on reinstallation.
The only thing I can think of is the ability to manually remove RemoveFolderEx from a custom action, which, as I know, I run at the right point and only with a true delete. Perhaps my custom action might use the C ++ dll and then manually add the command to the MSI, but if I go this far, it is possible that I will completely write the deletion logic.
Thank. Nile
EDIT: I finally got this working, here is a wix example to show what I did.
<Property Id='P.REMOVEDATAFOLDER' Secure='yes' />
<DirectoryRef Id="DATADIR">
<Component Id="C.RemoveDataFolder" Guid="myguid" KeyPath="yes">
<util:RemoveFolderEx On="uninstall" Property="P.REMOVEDATAFOLDER" />
</Component>
</DirectoryRef>
<CustomAction Id="CA.SetDataFolder" Property="P.REMOVEDATAFOLDER" Value='[DATADIR]' />
<InstallExecuteSequence>
<Custom Action="CA.SetDataFolder" Before="ValidateProductID" >(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
</InstallExecuteSequence>
The P.REMOVEDATAFOLDER property is only set to true deletion immediately after reading DATADIR from the registry, but before the CostInitialize action.
source
share