Uninstall non-setup created files
I have a Setup project (MSI) in VS2008 which installs my project. Within the project, I create a settings file, for the application, in the SpecialFolder.CommonApplicationData + \\"settings"
folder (the two slashes are in the C# code for escaping). However, the uninstaller doesn't get rid of this for me when it removes the program. How can I delete this folder during uninstallation? I've read that I should be using VB Script, but I've never used it before so not quite sure how to do it. I tried something like this:
On Error Resume Next
Dim fso, objfolder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(COMMON_FILES + "\\setti开发者_C百科ngs")
objfolder.Delete
Set folder = nothing
Set fso = nothing
but the setting files are still there after uninstallation. Any ideas? Thanks
Windows Installer has the RemoveFiles table for just this purpose. Unfortunatly the tool you've choosen doesn't expose this ( or many other ) feature. I suggest looking into another tool such as Windows Installer XML. Otherwise you'll be rolling fragile custom action antipatterns to work around the limitation.
Add a custom installer action and override Uninstall method to delete extra files.
See this article for more information about custom install actions: Installer Class and Custom Actions
精彩评论