Discussion:
[WiX-users] Custom rollback action needs to fire BEFORE remove files...
Adam Langley
2009-01-16 02:31:24 UTC
Permalink
In the same vein as my previous question...

My installer copies a file onto the target system, which is a windows service, however, its a 3rd party exe, and cannot be installed using the typical WiX method - it must be executed with "/service" as an argument.
This works.
However, my rollback custom action is getting fired AFTER the file is removed from the system, which is obviously a problem, because the file must be executed with "/unregserver" to clean up after itself.

Why is this happening? This is my WiX

<CustomAction Id="RegisterService" FileKey="olydvrsv.exe" ExeCommand="/Service" Execute="deferred" Impersonate="no" />
<CustomAction Id="RollbackRegisterService" FileKey="olydvrsv.exe" ExeCommand="/unregserver" Execute="rollback" Impersonate="no" />

<Custom Action="RegisterService" After="InstallFiles">1</Custom>
<Custom Action="RollbackRegisterService" Before="InstallFiles">1</Custom>

The install logs say:

MSI (s) (B0:D4) [18:22:48:465]: Executing op: ActionStart(Name=RollbackRegisterService,,)
MSI (s) (B0:D4) [18:22:48:475]: Executing op: CustomActionRollback(Action=RollbackRegisterService,ActionType=3346,Source=C:\Program Files\Common Files\olydvrsv.exe,Target=/unregserver,)
MSI (s) (B0:D4) [18:22:48:475]: Note: 1: 1721 2: RollbackRegisterService 3: C:\Program Files\Common Files\olydvrsv.exe 4: /unregserver
MSI (s) (B0:D4) [18:22:48:475]: Note: 1: 2205 2: 3: Error
MSI (s) (B0:D4) [18:22:48:475]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1721
Info 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RollbackRegisterService, location: C:\Program Files\Common Files\olydvrsv.exe, command: /unregserver

.. which makes sense, because its preceded by this (note the time stamps):

MSI (s) (B0:D4) [18:22:47:434]: Executing op: FileRemove(,FileName=C:\Program Files\Common Files\olydvrsv.exe,,)

So, the file is removed BEFORE the rollback custom action is fired - which is the wrong way around.

How can I get this the right way around?

Thanks!

Adam Langley
Senior Developer
Tel: +64 9 486 9010
***@winscribe.com
www.winscribe.com
 
 
Bob Arnson
2009-01-16 17:05:13 UTC
Permalink
Post by Adam Langley
<Custom Action="RegisterService" After="InstallFiles">1</Custom>
<Custom Action="RollbackRegisterService" Before="InstallFiles">1</Custom>
Rollback CAs need to be scheduled before the deferred CAs they roll
back. So you want to use Before="RegisterService".
--
sig://boB
http://joyofsetup.com/
Loading...