rho
Posts: 69
Joined: Tue May 12, 2009 1:22 pm

Custom Action in Rollback

I have a .NET custom action which installs custom files during install phase.
When I hit "cancel" while the MSI is installing, the log shows this:

Code: Select all

MSI (s) (F0:F0) [13:19:56:145]: Executing op: TypeLibraryRegister(...
RegisterTypeLibraries: ...
MSI (s) (F0:F0) [13:19:56:157]: Executing op: ActionStart(Name=configInstall,,)
Aktion 13:19:56: configInstall. 
MSI (s) (F0:F0) [13:19:56:159]: Executing op: CustomActionSchedule(Action=configInstall,ActionType=3137,Source=BinaryData,Target=LaunchDotNetCustomAction,CustomActionData=/LogFile= /ReqVersion=4.0.30319 /InstallType=notransaction /Action=Install ...
Aktion 13:19:57: CancelDlg. Dialog created
Aktion 13:20:11: Rollback. Aktion wird rückgängig gemacht:
RollbackAction=Rollback,RollbackDescription=Aktion wird rückgängig gemacht:,,CleanupAction=RollbackCleanup,CleanupDescription=Sicherungsdateien werden entfernt,CleanupTemplate=Datei: [1])
1: configInstall 
MSI (s) (F0:F0) [13:20:11:633]: Executing op: ActionStart(Name=configInstall,,)
Looks like, the custom action is called again after Cancel was triggered.
After everything is rolled back, the files created by the custom action still exist. I have a nother .NET custom action called configUninstall, which is normally triggered while uninstalling the MSI.
- how can I run the configUninstall action at the start of the rollback phase?
- is configInstall called twice?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Custom Action in Rollback

Hello,

No, I don't think your "configInstall" action is not executed twice. More likely this confusion is created by the way Windows Installer writes the log file.

To run the "configUninstall" action on rollback phase you should create another custom action scheduled just before the "configInstall" action and having the execution time set to "During installation rollback" option.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rho
Posts: 69
Joined: Tue May 12, 2009 1:22 pm

Re: Custom Action in Rollback

Thanks for your reply.
Is there a reason to put it in front of configInstall instead of behind it?
Which execution stage condition should I choose?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Custom Action in Rollback

Hello,

Yes, the reason is that Windows Installer, in case of a custom action error, executes only the rollback actions scheduled in sequence prior to the action which failed. For every custom action you have (which modifies the system) you should also use a sibling custom action, configured to execute on rollback and scheduled in sequence just before the install custom action, which will undo the system change done by the install custom action.

You should not set any condition for the rollback custom action. Just configure it to execute on rollback.

If you have any questions or doubts just let me know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”