I am trying to remove the folder hierarchy using RemoveFolderEx, but only when uninstalling the software. Currently, when I do the reinstallation, it also deletes all folders that delete all unwanted files created by the program. This is probably due to the fact that I installed that the software will be removed before reinstalling it.
<InstallExecuteSequence> <RemoveExistingProducts Before="InstallInitialize" /> </InstallExecuteSequence>
Is it possible to impose a condition on the next element? Should I wrap it in my own component and then add the condition inside? I could not get it to work so far.
<util:RemoveFolderEx On="uninstall" Property="MAINDIR" ></util:RemoveFolderEx>
From another question that I know should be
((NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL"))
but I'm not quite 100% on how to apply this to the removefolder element, if possible.
I assume that I can set the folder path to empty in a user action that was subject to a condition, but that just seems to be hacked.
Greetings. Nile
EDIT: I almost got this working by putting removefolderex into my own component. Without a condition, it works as expected and deletes the data directory upon uninstallation and reinstallation. When I add a condition in it, it does not start, but I hope that it is not the way it would be wrong.
<DirectoryRef Id="DATADIR"> <Component Id="C.RemoveDataFolder" Guid="myguid" KeyPath="yes"> <util:RemoveFolderEx On="uninstall" Property="DATADIR" ></util:RemoveFolderEx> <Condition>(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Condition> </Component> </DirectoryRef>
Does anyone know if the above expression supports or it will never work? Can I apply this condition to a component?
source share