WIX 自定义操作 - 在不同时间运行安装、升级和卸载
我有一个自定义操作,可以在卸载过程中删除各种目录。我想根据正在执行的操作在安装顺序的不同点调用此操作:
- 在安装期间,不要运行自定义操作
- 在升级期间,在删除现有产品之后运行自定义操作
- 在卸载期间,在删除文件夹之后运行自定义操作
我可能可以让其中每一个单独工作,但是如何让它们按照我想要的方式一起工作。我尝试了这样的事情(一些代码取自 此处):
<InstallExecuteSequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">
NEWERPRODUCTFOUND AND NOT Installed
</Custom>
<LaunchConditions After="AppSearch" />
<RemoveExistingProducts Before="InstallInitialize" />
<!-- NEW _> Clean old files AFTER uninstall during an upgrade -->
<Custom Action="CleanUp" After="RemoveExistingProducts" >
UPGRADINGPRODUCTCODE
</Custom>
<!-- NEW _> Clean old files LAST during an uninstall -->
<Custom Action="CleanUp" After="RemoveFolders" >
(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
</Custom>
</InstallExecuteSequence>
但是当我进行构建时出现重复符号错误。任何帮助将不胜感激!
I have a custom action that removes various directories as part of the uninstall process. I want to call this action at different points in the install sequence depending on what's being done:
- During an install, don't run the custom action
- During an upgrade, run the custom action after RemoveExistingProducts
- During an uninstall, run the custom action after RemoveFolders
I can likely get each one of these to work individually, but how do I get them to work together how I want. I tried something like this (some code take from here):
<InstallExecuteSequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">
NEWERPRODUCTFOUND AND NOT Installed
</Custom>
<LaunchConditions After="AppSearch" />
<RemoveExistingProducts Before="InstallInitialize" />
<!-- NEW _> Clean old files AFTER uninstall during an upgrade -->
<Custom Action="CleanUp" After="RemoveExistingProducts" >
UPGRADINGPRODUCTCODE
</Custom>
<!-- NEW _> Clean old files LAST during an uninstall -->
<Custom Action="CleanUp" After="RemoveFolders" >
(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
</Custom>
</InstallExecuteSequence>
But get a duplicate symbol error when I do a build. Any help will be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以使用RemoveFiles 删除目录中的无关文件。
You can also use RemoveFiles to get rid of the extraneous files in a directory.
自定义操作只能在序列中出现一次。不过,我有一些更大的担忧:您正在进行什么类型的升级?主要升级会卸载以前的产品,因此您的 CA 的运行方式可能是您所描述的两倍。
我在这里会非常小心。您可以使用 WiX RemoveFolder 元素(MSI RemoveFile 表)吗?这将更容易、更可靠地实施。如果您必须使用自定义操作,我将使用组件操作状态来确定它何时应该运行,而不是像上面所示的更通用的属性。
A custom action can be in a sequence only once. I have some bigger concerns though: what type of upgrade are you doing? A major upgrade does a uninstall of the previous product so your CA might run twice the way you are describing it.
I would tread really lightly here. Can you possibly use the WiX RemoveFolder element ( MSI RemoveFile table ). This will be alot easier and reliable to implement. If you must use a custom action I would use component action states to determine when it should run rather then more generic properties like shown above.