安装失败后的自定义操作

Bha*_*a K 3 windows-installer installshield custom-action wix

如何仅在安装中断或错误完成时才对自定义操作执行排序?

是否有任何Windows安装程序属性返回当前安装状态(失败/成功)?

Yan*_*nko 7

元素的OnExit属性<Custom>是您正在寻找的.这是相互排斥的Before,AfterSequence属性,可以有以下值:success,cancel,error,suspend.

更新:基本上,这就是我的意思:

1)定义一个自定义操作,它将执行您希望它执行的工作(收集一些故障数据).请注意,您必须定义指向同一目标的N个自定义操作,因为CustomAction MSI表需要Id作为主键(假设它是DLL CA):

<CustomAction Id="LogFailureOnCancel" BinaryKey="CustomActions" DllEntry="LogFailure" ... />
<CustomAction Id="LogFailureOnError" BinaryKey="CustomActions" DllEntry="LogFailure" ... />
Run Code Online (Sandbox Code Playgroud)

注意:两个定义都指向相同的实际操作(DllEntry属性).

2)适当地安排这些自定义操作:

 <Custom Action="LogFailureOnCancel" OnExit="cancel" />
 <Custom Action="LogFailureOnError" OnExit="error" />
Run Code Online (Sandbox Code Playgroud)