Вопрос

I have custom action scheduled after InstallFinalize. When I run a setup, and it fails, I noticed that I get error screen that setup failed and no changes were done to my computer, but if I run setup again, it has options to repair, change or remove. I assume that it's because the rollback event isn't triggered. How can I make it happen?

Это было полезно?

Решение

The InstallFinalize action is when the installation transaction is committed to the machine. Anything that happens after that point (or before InstallInitialize) happen outside the transaction. That means they cannot be rolled back.

Instead, you'll need to schedule your custom action sometime after InstallInitialize and before InstallFinalize in order for it to error and cause rollback. Additionally, a custom action that modifies machine state should be deferred. This topic in the MSI SDK is a good place to start and then read topics around it.

If you'd like to see examples of the way to write custom actions, I'd recommend looking at some examples in the WiX toolset in src\ca\wixca\dll. Lots of different kinds of custom actions doing things in a way I hope is "correct" according to the MSI SDK.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top