How to remove files in %APPDATA% directory when uninstalling in a VS Setup Project?
My application (the application itself, not the 开发者_运维技巧installer) creates some files in the directory %APPDATA%\Application
.
How can I clean that directory when uninstalling my application?
I would prefer something different like a .bat
or similar in the installation directory and executing it in the Uninstall process.
For the %APPDATA%\Application Element, are you able to set Permanent Property to False ?
You can try using a Remove File operation to delete your application files and RemoveDirectory function (in a custom EXE for example) to remove the folder. The custom EXE can be added as a custom action and it can read the install path from the registry or a configuration file (it depends on where you want to save it during install).
With this approach you can delete only the files you want and the folder is removed only if it's empty. So there isn't a real danger of deleting user files.
精彩评论