When uninstalling my application, I'd like to configure the Wix setup to remove all the files that were added after the original installation. It seems like the uninstaller removes only the directories and files that were originally installed from the MSI file and it leaves everything else that was added later in the application folder. In another words, I'd like to purge the directory when uninstalling. How do I do that?
相关问题
- How does the setup bootstrapper detect if prerequi
- Wix: How can I set, at runtime, the text to be dis
- Mysql-installer showing error : Memoy could not be
- Wix variable name formats with spaces and other ch
- Cancel installation from my custom action
相关文章
- chained msi's/Bootstrapper/prerequisite?
- How do I require a value in a textbox in a Wix cus
- How to prevent WiX bundle with same UpgradeCode/Ve
- How do I pass a default 'install location'
- Running msiexec from a service (Local System accou
- Set InstallPath registry key using Visual Studio S
- Looking for a flexible windows installer product w
- Can I use msilib or other Python libraries to extr
Here's a variation on @tronda's suggestion. I'm deleting a file "install.log" that gets created by another Custom Action, during Uninstall:
As far as I understand, I can't use "RemoveFile" because this file is created after the installation, and is not part of a Component Group.
To do this, I simply created a custom action to be called on uninstall.
The WiX code will look like this:
The code for the OnBeforeUninstall method in InstallerCustomActions.DLL will look like this (in VB).
This would be a more complete answer for @Pavel suggestion, for me it's working 100%:
And, under Product element:
This approach set a registry value with the desired path of the folder to be deleted on uninstall. At the end, both INSTALLFOLDER and registry folder are removed from the system. Note that the path to the registry can be at other hive and other locations.
Use RemoveFile element with On="uninstall". Here's an example:
Update
Unfortunately Windows Installer doesn't support deleting directories with subdirectories. In this case you have to resort to custom action. Or, if you know what subfolders are, create a bunch of RemoveFolder and RemoveFile elements.
Not an WIX expert, but could a possible (simpler?) solution to this be to run the Quiet Execution Custom Action which is part of the built in extensions of WIX?
Could run the rmdir MS DOS command with the /S and /Q options.
And the custom action doing the job is simple:
Then you'll have to modify the InstallExecuteSequence as documented many places.
Update: Had issues with this approach. Ended up making a custom task instead, but still considers this a viable solution, but without getting the details to work.
Use
RemoveFolderEx
element from Util extension in WiX.With this approach, all the subdirectories are also removed (as opposed to using
RemoveFile
element directly). This element adds temporary rows toRemoveFile
andRemoveFolder
table in the MSI database.