【发布时间】:2015-03-25 04:12:44
【问题描述】:
在安装过程中,选择目录为 C:/Test/(安装位置的根路径)来安装我的应用程序。它已成功安装在此位置 (C:/Test/)。卸载此软件包,它会删除所有已安装的文件和子目录。但未删除已安装的根目录(即 C:/Test)。下面的自定义操作用于删除/删除安装根路径和安装文件(带有子目录)。
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
<Custom Action="ApplicationInstallDir" After="AppSearch">APPINSTALLDIR</Custom>
<Custom Action="DeleteInstallDir" Before="RemoveFiles" >
REMOVE="ALL"
</Custom>
</InstallExecuteSequence>
<CustomAction Id="DeleteInstallDir" BinaryKey="CommandPrompt"
ExeCommand="cmd /C pushd "[APPINSTALLDIR]" && (rd /s /q "[APPINSTALLDIR]" 2>nul & popd)" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />
【问题讨论】:
-
Windows Installer 应该会自动卸载它,而无需调用 cmd 会话。您的安装程序还有其他问题。
-
..除了 Chris 的评论之外,您也不会使用代码,因为 WiX 提供了 RemoveFile 元素。
标签: wix windows-installer uninstallation wix3.5