We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

devans55
Posts: 4
Joined: Mon Feb 18, 2019 4:50 pm

rollback issues

We've made an installer that installs and sets up an application and runs the application as a service. After doing this the advanced installer app moves on to our own custom authentication process using a custom dll and the installed running service. The question I have seems simple... how can I rollback all that has been done at this point if needed? In a way I want to switch over to maintenance mode and remove the installation completely. I can't seem to find any info about doing this on the forums.
Thanks,
David
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: rollback issues

Hello David and welcome to our forums,

I am not quite sure I understand what you want to achieve here. By "how can I rollback ..." do you mean that if the installation fails, you want to rollback all the changes made to the system up until that point? If this is the case, then you can create your own custom action which will undo the custom changes made and schedule it to run "During installation rollback".

The rollback actions are used when the application is installed, but something went wrong and the installation must be rolled back. While the installation script is executed, the installer builds a rollback script. After every standard action is executed, the installer adds a rollback command to the rollback script. With this being said, since the changes made to the system are done through custom actions, a way to revert those would be to create your own custom action as explained above.

Please let me know if this is what you were looking for. If not, could you please give me some more details about what you want to achieve here (maybe exemplify) so I can make a better idea of how I can help you?

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
devans55
Posts: 4
Joined: Mon Feb 18, 2019 4:50 pm

Re: rollback issues

Hello Catalin,

Thanks for the quick response, let me run through what we're doing in sequence.

1. this is a first time install with a service (using the advanced installer service stuff, no custom actions)
2. we go through the usual built in dialogs (welcome, licensing, folder) and get to VerifyReady
3. user hits install which installs the service and gets it running (no custom actions at this point)
4. after the "installation" we open our own auth dialog which does custom actions (but does not really alter the system)
5. if the user in this dialog hits cancel I want to rollback (uninstall) everything that's been done up to this point, including stopping and removing the installed service.

I'm sure this is pretty basic, how do I trigger the rollback script you mention in your reply?

Best,
David
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: rollback issues

Hello David,

Thank you for the explanation on this.

One thing worth mentioning here is the fact that only the deferred (and also commit) actions are rolled back. The rollback is done automatically by Windows Installer. For instance, if you press the "Cancel" button during the immediate stages of the installation process, the following dialog will be shown:
ImmediateCancel.PNG
ImmediateCancel.PNG (72.3 KiB) Viewed 8166 times

This is done because the Immediate actions (both Standard and Custom) should not alter(modify) the system.

The other case is when the installation process is interrupted during the deferred stage. When this happens, the standard actions are rolled back automatically. However, if you have a custom action that does modify the system, you will need to create another custom action that will undo these changes and schedule it before the deferred action in the installation sequence as it follows:
Schedule.PNG
Schedule.PNG (14.68 KiB) Viewed 8166 times
Where the "Deferred" custom action is your custom action that has its "Execution Time" of "When the system is being modified (deferred)" and the "Rollback_action" has its "Execution Time" of "During installation rollback".

Attached you can find a project which I have created for you reference.
testRollback.aip
(14.76 KiB) Downloaded 373 times
It only contains two custom actions, one that creates a directory called "Test" on the drive "C:\", pops a message box that lets the user know that the directory was created (I've added this message box mainly so you can see that the modifications were made, i.e. the folder was created) and then forces an exit code of "3" (which means failure). After that happens, the rollback action is triggered, which removes the earlier created folder.

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
devans55
Posts: 4
Joined: Mon Feb 18, 2019 4:50 pm

Re: rollback issues

Hi,

I think I understand what you're saying, although I'm not sure it applies to what we'd like to do. If I'm correct, what you're saying is that any custom action that will modify the system must be uninstalled through a custom action itself during the Install Execution Stage and prior to the Finish Execution action. However we are not doing any custom actions until after the Install Execution Stage. We do our authentication following the Install Execution Stage and inside the Finish Dialogs Stage. What we do with our custom actions does not alter the system. We'd like to be able to uninstall after everything has already been installed. Does this make sense?
install seq.png
install seq.png (17.63 KiB) Viewed 8161 times
Best,
David
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: rollback issues

Hello David,
If I'm correct, what you're saying is that any custom action that will modify the system must be uninstalled through a custom action itself during the Install Execution Stage and prior to the Finish Execution action.
Indeed, you are right. Every custom action that alters the system during the deferred stage of the "Install Execution Stage" can only be rolled back through another custom action that undoes the changes.

I am afraid that, as in its definition, a rollback action can not be performed after the deferred stage. However, I think you can achieve what you want through a custom action that will uninstall your product if the user presses cancel. For this, you can use a custom action without sequence which can be triggered from a dialog control. For instance, you can use a "Launch file" custom action configured as it follows:

File to launch: msiexec.exe
Command line: /x [ProductCode]
Working directory: [SystemFolder]


Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
devans55
Posts: 4
Joined: Mon Feb 18, 2019 4:50 pm

Re: rollback issues

Hi Catalin,

Yes, this could be what I'm looking for, I'll give it a shot.

Thanks!
David
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: rollback issues

You are always welcome, David.

Glad I could help.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”