- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Avoid rollback in InstallScript project
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi,
I have an InstallScript project where I set a registry value at the beginning marking the installation as "Failed".
Only in the end after successful installation, I change the registry value to "Successful" (actually it's "0" and "1", but that shouldn't matter).
My problem is that once the installation is aborted the registry value will be removed, so obviously a rollback is done. Is there any chance to keep it even after abort?
I tried to set it in the OnAbort function but unfortunately this doesn't help.
The initial value is set correctly. If I check the registry during installation I can see the "Failed" value for a short moment before the installation is aborted and the registry value disappears again.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Have you tried:
Disable(LOGGING)
and
Enable(LOGGING)
see the help file for details.
regards
Markus
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @Pizzamampf ,
Useful KB-that talks in detail about how and when rollback action happens.
I would need few information to help you with:
- How do you add registry entries?Is it via registry view or via installscript function?
- How are you triggering abort?
- You might not be able to control rollback in OnAbort function since it will get called on executing abort() function
If you create registry entry via installscript function when abort gets called (Or via custom action,since you had mentioned InstallScript project it doesn't have custom-action view),that won't be added to rollback script unless until you explicitly clean that.Can you give it a try?
Thanks,
Jenifer
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi Jenifer,
I am setting the registry value through InstallScript like this:
RegDBSetKeyValueEx("SOFTWARE\\MYAPP", "INSTALLRESULT", REGDB_STRING, "1", -1);
Currently it is placed at the beginning of the OnInstalled function for the main (and only) feature.
Additionally, I also tried to add the same line in the OnAbort function, but in both cases it is removed when the installation aborts.
I am triggering aborts of the installation through a call of
abort;
I'm doing all necessary rollback actions in the OnAbort function, so actually the installation doesn't need to roll back anything at all. I know for MSI installations there's a switch to deactivate rollback, but I don't know of anything similar in InstallScript installations (actually I didn't even know it would do a rollback).
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Have you tried:
Disable(LOGGING)
and
Enable(LOGGING)
see the help file for details.
regards
Markus
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi @Pizzamampf ,
Since these rollback events are handled by installscript engine not via MSI engine there is no way to control/stop rollback behavior that has made changes to the target system.
Note from Flexera-InstallShield documentation on OnAbort event:
The OnAbort event handler responds to the Abort event that is generated by the InstallScript abort statement, which uninstalls any changes made to the target system and then exits. In the event handler, you can place any additional cleanup code that you require, such as deleting temporary files created by your installation.
The added reference link in my previous reply to give idea about how rollback occurs in general.
If your aim is to get status of installation,you can give a try with return code from setup.exe.(Which can also be customized from IS2019 onwards using Releases->Setup.exe->Custom return codes view)
The below link can give you common return codes with respect to installscript project built setup.exe:
Thanks,
Jenifer
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Thank you for the information.
Unfortunately the return code of the installation itself doesn't help here because another application later has to get the result through registry lookup.
I'll probably just say, if the registry value is there it was successful, if it isn't there the installation has failed.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Here is a link to the online help:
regards
Markus
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Thank you very much! This link solved the problem for me.
I could keep the registry value even on rollback by using Disable/Enable:
Disable(LOGGING); RegDBSetKeyValueEx("SOFTWARE\\MYAPP", "INSTALLRESULT", REGDB_STRING, "1", -1); Enable(LOGGING);
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
P.S. Sorry, I didn't see your first post in here, my answer yesterday wasn't meant towards you.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
It was clear to me, that your 1st answer was not related to my post 🙂
Fine, that your problem is solved now.
regards
Markus