【发布时间】:2015-07-28 19:00:25
【问题描述】:
在安装时,我使用命令行工具将配置密钥添加到数据库。在卸载时,我现在正在尝试删除该配置密钥。在升级时,我需要删除然后重新添加配置密钥。
这是我的 CustomAction “编辑”代码:
<CustomAction Id="Unset_AppName_Version_Cmd"
Property="Unset_AppName_Version"
Execute="immediate"
Value=""[SystemFolder]cmd.exe" /C ""[SOMEDIR]SomeClTool" "uninstall:appname""" />
<CustomAction Id="Unset_AppName_Version"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="immediate"
Return="check"
Impersonate="yes" />
注意:我尝试了几个执行值,包括 oncePerProcess、firstSequence 和 immediate。
这是我的 InstallExecuteSequence “编辑”代码:
<Custom Action="Unset_AppName_Version_Cmd" Sequence="1215">
(!AppName = 3 AND (&AppName = 3 OR &AppName = 2))
</Custom>
<Custom Action="Unset_AppName_Version" Sequence="1216">
(!AppName = 3 AND (&AppName = 3 OR &AppName = 2))
</Custom>
注意:我再次尝试移动使用的序列。在上面的例子中,在InstallValidate 之前,也可以在RemoveFiles、RemoveODBC 等之前。
没有什么对我有用。在所有情况下,
Executing op: ActionStart(Name=Unset_AppName_Version,,)
在 RemoveFiles 之后运行行,因此我的自定义操作失败:
CAQuietExec: The system cannot find the path specified.
CAQuietExec: Error 0x80070001: Command line returned an error.
CAQuietExec: Error 0x80070001: CAQuietExec Failed
在此之后,我的安装会回滚。
另外,这种情况是否适合在卸载或重新安装时运行?
(!AppName = 3 AND (&AppName = 3 OR &AppName = 2))
谢谢
2015 年 7 月 31 日更新
虽然我仍然没有可行的解决方案,但我已经做出了足够多的更改,因此发布我当前的代码是有意义的。
这是我更新后的 CustomAction “编辑”代码:
<CustomAction Id="Unset_AppName_Version_Cmd"
Property="QtExecCmdLine"
Value=""[SystemFolder]cmd.exe" /C ""[SOMEDIR]SomeClTool" "uninstall:appname"""
Execute="immediate" />
<CustomAction Id="Unset_AppName_Version"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="immediate"
Return="ignore" />
注意:这些更改是基于 Kiran 非常赞赏的建议并模仿一些对我有用的 taskkill 命令。
工作代码示例:
<CustomAction Id="TaskKill_erl_exe_Cmd"
Property="QtExecCmdLine"
Value='"[SystemFolder]taskkill.exe" /F /IM erl.exe /T'
Execute="immediate" />
<CustomAction Id="TaskKill_erl_exe"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="immediate"
Return="ignore"/>
谢谢
【问题讨论】:
标签: wix sequence custom-action