I'm trying to start a certain Windows service from [Code]
section (in AfterInstall
handler). When it fails to start I'd like to rollback installation.
Typically when setup is ran from UI, WizardForm.Close()
does the job right. But when installer is executed with /verysilent
command line parameter, WizardForm.Close
seems to be ignored and installation goes on.
I also tried Abort()
, suggested by other article on Stack Overflow, but it works just like any other suppressiblemsgbox and doesn't break the installation.
Is there any way to conditionally abort installation in /verysilent
mode?
There's no way to trigger rollback programmatically.
All you can do is to forcefully abort the installation using the
ExitProcess
WinAPI function.Credits: Exit from Inno Setup Installation from [code].
A cleaner solution would be to install the file and start the Windows service programmatically at the beginning of the
CurStepChanged(ssInstall)
. And use theAbort
function to interrupt the installation, if something goes wrong. In this context theAbort
works. See the function documentation.