卸载 WiX 时删除文件 [英] Removing files when uninstalling WiX

查看:25
本文介绍了卸载 WiX 时删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

卸载我的应用程序时,我想配置 Wix 设置以删除所有在原始安装后添加的文件.卸载程序似乎只删除了最初从 MSI 文件中安装的目录和文件,而将稍后添加到应用程序文件夹中的所有其他内容都保留了下来.换句话说,我想在卸载时清除目录.我该怎么做?

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?

推荐答案

使用 RemoveFile 元素,带 On="卸载".下面是一个例子:

Use RemoveFile element with On="uninstall". Here's an example:

<Directory Id="CommonAppDataFolder" Name="CommonAppDataFolder">
  <Directory Id="MyAppFolder" Name="My">
    <Component Id="MyAppFolder" Guid="*">
      <CreateFolder />
      <RemoveFile Id="PurgeAppFolder" Name="*.*" On="uninstall" />
    </Component>
  </Directory>
</Directory>

更新

它没有 100% 起作用.它删除了文件,但没有删除任何其他目录 -安装后创建的那些 - 被删除了.对此有何想法?– 普里贝罗

It didn't work 100%. It removed the files, however none of the additional directories - the ones created after the installation - were removed. Any thoughts on that? – pribeiro

遗憾的是,Windows Installer 不支持删除带有子目录的目录.在这种情况下,您必须求助于自定义操作.或者,如果您知道子文件夹是什么,创建一堆 RemoveFolder 和 RemoveFile 元素.

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.

这篇关于卸载 WiX 时删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆