维克斯.取消安装时回滚自定义操作

我有自定义动作

<CustomAction Id="myActionId" BinaryKey="myAction" DllEntry="MySimpleAction" Execute="immediate" Return="check" />

<InstallExecuteSequence>
      <Custom Action="myActionId" After="InstallInitialize">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>

我的自定义操作可以备份和解析数据库.取消安装时我需要做回滚(drop database).
我做了:

<CustomAction Id="myActionId" BinaryKey="myAction" DllEntry="MySimpleAction" Execute="immediate" Return="check" />
<CustomAction Id="myActionRollbackId" BinaryKey="myActionRollback" DllEntry="MySimpleAction" Execute="rollback" Return="check" />

<InstallExecuteSequence>
      <Custom Action="myActionId" After="InstallInitialize">CHECKBOXCOPYPROP=1</Custom>
      <Custom Action="myActionRollbackId" Before="myActionId">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>

但我有一个错误.

如果我喜欢这样:

<CustomAction Id="myActionId" BinaryKey="myAction" DllEntry="MySimpleAction" Execute="immediate" Return="check" />
<CustomAction Id="myActionRollbackId" BinaryKey="myActionRollback" DllEntry="MySimpleAction" Execute="immediate" Return="check" />

<InstallExecuteSequence>
      <Custom Action="myActionId" After="InstallInitialize">CHECKBOXCOPYPROP=1</Custom>
      <Custom Action="myActionRollbackId" After="myActionId">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>

我的自定义操作myActionRollbackId有效.

取消安装时如何运行rolback?
有人可以帮帮我吗?

最佳答案 应该推迟在安装时运行并对数据库执行某些操作的自定义操作(Execute =’deferred’).其相应的回滚操作应为Execute =’rollback’.在计划这些自定义操作时,应首先执行回滚操作.

另外,请确保正确设置条件.

点赞