Pat
Pat

Reputation: 16901

Show that a failure has occurred and rollback or quit installer (NSIS)

If I try to install an MSI and it returns with an error code, how do I gracefully rollback or quit the installer?

Upvotes: 0

Views: 1882

Answers (3)

Igliv
Igliv

Reputation: 214

You can use:

ExecWait 'msiexec /i "$INSTDIR\something.msi"' $0
${If} $0 != '0' 
    MessageBox MB_OK|MB_ICONSTOP 'Install Failed!'
    Abort "Install failed"
${EndIf}    

Just like @Anders said you have to take care of the rollback by yourself

Upvotes: 0

Pat
Pat

Reputation: 16901

I think that the Abort command might be the correct approach.

Upvotes: 0

Anders
Anders

Reputation: 101746

There is no automatic rollback, NSIS can't tell which of the operations should be rolled back and how.

You have to deal with this yourself, either by rolling back each operation or starting your uninstaller in silent mode (ExecWait'"$instdir\youruninstaller.exe" /S _?=$instdir' (You must delete the uninstaller and $instdir after this))

Upvotes: 1

Related Questions