Custom Installer class , rollback method never called.

Posted by yossi1981 on Stack Overflow See other posts from Stack Overflow or by yossi1981
Published on 2009-09-16T10:28:07Z Indexed on 2010/04/07 11:03 UTC
Read the original article Hit count: 560

Filed under:
|
|
|
|

Hi guys.

I am having an installer class , Here is a snippet:

[RunInstaller(true)]
public partial class ServerWrapInstaller : Installer
{
    public override void Install(IDictionary stateSaver)
    {
        EventLog.WriteEntry("Installer", "Install", EventLogEntryType.Information);
        base.Install(stateSaver);
    }

    public override void Commit(IDictionary savedState)
    {
        EventLog.WriteEntry("Installer", "Commit", EventLogEntryType.Information);
        base.Commit(savedState);
    }

    public override void Rollback(IDictionary savedState)
    {
        EventLog.WriteEntry("Installer", "Rollback", EventLogEntryType.Information);
        base.Rollback(savedState);
    }

    public override void Uninstall(IDictionary savedState)
    {
        EventLog.WriteEntry("Installer", "UnInstall", EventLogEntryType.Information);
        base.Uninstall(savedState);
    }
 }

Now i start the installation in full GUI mode and then click the "Cancel" button in the middle of the process causing the installation to roll back. The problem is that the RollBack method is not called. I don't see the expected entry in the event log.

I want to mention that if i let the installation to complete , I do see the "Install" message in the event log and If i then uninstall , I see the "uninstall" message in the event log. But if stop the installtion process in the middle , by pressing the "cancel" button , I do see the progress bar going backward , but the rollback method is not called.

what am I doing wrong ? thanks in advance for any help.

Edit:

Providing more details...

The installer is an MSI package.

The package is built in vs2009 using a setup project. The installer class is used as a custom action by the setup project.

Since this is a MSI Package I have an option to run it in silent mode or in user-interactive more . When I wrote "Full GUI mode" , I ment User-Interactive mode.

© Stack Overflow or respective owner

Related posts about msi

Related posts about installer