开发者

Uninstall non-setup created files

开发者 https://www.devze.com 2023-01-11 21:48 出处:网络
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\" folde

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号