WIX:安装过程中使用临时文件
我正在编写 WIX 安装程序,并且有以下要求:
在安装过程中,我需要将安装程序中包含的文件(我们称之为 A)的绝对路径传递给 COM 组件,该组件已存在于硬盘驱动器上并且是另一个程序的一部分。我已经编写了一个适当的自定义操作,它需要文件 A 的路径。我不想将 A 作为安装在 Program Files 文件夹中并在卸载过程中删除的文件包含在内。相反,我想将 A 仅临时放在硬盘驱动器上,调用我的自定义操作,这将导致 COM 组件使用 A 的内容,然后从磁盘中删除 A。有没有一种简单的方法可以实现这个目标?
我尝试利用二进制表并将 A 存储在那里,但是我不知道如何使用绝对路径引用 A。我知道我可以将 A 放在 MSI 文件之外,但我想将安装程序所需的每个文件保留在一个 MSI 中。
任何帮助将不胜感激。
I am writing a WIX installer and I have a following requirement:
During installation, I need to pass an absolute path to a file (lets call it A) included in my installer to a COM component, which already exists on the hard drive and is a part of another program. I have already written an appropriate Custom Action which expects a path to the file A. I don't want to include A as a file installed in the Program Files folder and removed during the uninstallation process. Instead, I would like to put A only temporary on the hard drive, call my Custom Action which will cause the COM component to use the content of A, and then remove A from disk. Is there an easy way to accomplish this goal?
I have tried to utilize the Binary Table and store A there, however I don't know how to reference A using absolute path. I know I could put A outside of MSI file but I would like to keep every file installer needs in a single MSI.
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除 MSI 安装的文件意味着 MSI 将认为该文件“已损坏”,并在需要时尝试自动修复它。在某些情况下(例如,广告的快捷方式和 COM 注册)会自动发生这种情况,因此我建议不要这样做。把文件留在那里——它已经完成了它的工作,把它留在那里也没有什么坏处。
Deleting a file that MSI installed means that MSI will consider it "broken" and try to auto-repair it if called on to do so. That happens automatically in several cases (e.g., advertised shortcuts and COM registration) so I'd recommend against it. Leave the file there instead -- it's done its job and there's no harm in leaving it there.
我会采取这种方法。
将文件“A”安装到任意目录中。运行更新 COM 组件所需的自定义操作。然后运行另一自定义操作或修改当前写入的操作以在文件不再使用后将其删除。这将不会留下文件“A”的痕迹,并且如果您将自定义操作安排为仅在安装期间运行,则无需在卸载时担心它。
I would take this approach.
Install the file "A" into any directory. Run your custom action needed to update the COM component. Then run another custom action or modify the currently written one to remove the file after it is no longer in use. This would leave no trace of the file "A" and if you schedule the custom action to only run during the install you won't have to worry about it on uninstall.