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

ken*_*nai 5 installation custom-action wix rollback

我有一个自定义操作

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

<InstallExecuteSequence>
      <Custom Action="myActionId" After="InstallInitialize">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)

我的自定义操作会备份和解析数据库。取消安装时,我需要回滚(删除数据库)。我做了:

<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>
Run Code Online (Sandbox Code Playgroud)

但我有一个错误。

如果我喜欢这样:

<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>
Run Code Online (Sandbox Code Playgroud)

我的自定义操作 myActionRollbackId 有效。

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

Yan*_*nko 2

应推迟在安装时运行并对数据库执行某些操作的自定义操作 ( Execute='deferred')。其对应的回滚动作应该是Execute='rollback'。当您安排这些自定义操作时,应首先执行回滚操作。

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