安装 MSI 之前删除文件和目录

发布于 2024-11-17 00:09:11 字数 675 浏览 1 评论 0原文

多年来,我们的产品都是通过 InstallShield 安装程序安装的。我今年将安装更改为 MSI (WiX)。现在 MSI 应该清理该目录,该目录保持不变。

我在 MSI 中实施了一个自定义操作来开始卸载旧产品:

 <CustomAction Id="UninstallIS" Property="QtExecCA" Value="&quot;[WindowsFolder]IsUn0407.exe&quot; -f &quot;[ProgramFilesFolder]\company\product\Uninst.isu&quot;" Execute="deferred" />
 <CustomAction Id="QtExecCA" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no" />

删除旧产品后,存在临时文件和一些子目录,这些文件因客户端而异,并且 InstallShield 安装程序不知道,所以我会尝试通过 MSI 删除它们。

记住UAC,我认为我不能使用命令行命令来执行此操作,而且“删除文件表”在这里没有用(对于许多未知文件和许多目录)。

有什么可能的方法来做到这一点?

感谢您的帮助!

Our product was installed via InstallShield Setup over the years. I changed the installation to MSI (WiX) this year. Now the MSI should clean up the directory, which remains the same.

One custom action in the MSI I implemented to start the uninstallation of the old product:

 <CustomAction Id="UninstallIS" Property="QtExecCA" Value=""[WindowsFolder]IsUn0407.exe" -f "[ProgramFilesFolder]\company\product\Uninst.isu"" Execute="deferred" />
 <CustomAction Id="QtExecCA" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no" />

After the removal of the old product there are temporary files and some subdirectories that are different from client to client and are unknown to the InstallShield Setup, so I would try to delete them via the MSI.

Keeping the UAC in mind, I think that I can't use command-line commands to do this also the 'Remove File Table' is not useful here (to much unknown files and many directories).

What is a possible way to do this?

Thank You for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝戈者 2024-11-24 00:09:11

您可以使用将模拟标记设置为“否”的延迟自定义操作。这样它将在具有完全权限的本地系统帐户下运行。

自定义操作可以使用自定义代码(例如 EXE 或 DLL)或命令行。

请注意,延迟的自定义操作只能在 InstallExecuteSequence 中的 InstallInitialize 操作之后安排。

作为旁注,请确保对其进行彻底测试。从目标机器上删除文件是非常危险的。你永远不知道你最终会删除什么。

You can use a Deferred custom action which has Impersonate flag set to "no". This way it will run under the local system account with full privileges.

The custom action can use custom code (for example an EXE or DLL) or a command line.

Please note that deferred custom actions can be scheduled only after InstallInitialize action in InstallExecuteSequence.

As a side-note, make sure you thoroughly test it. Deleting files from the target machine is very dangerous. You never know what you may end up deleting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文