views:

537

answers:

2

Hi,

I am writing an installer for my web app and I struggle with the uninstaller part. Despite the fact that I created a custom action on Uninstall in my Application Setup Project, the InstallerClass is set to true, the method:

public override void Uninstall(IDictionary savedState)
    {
        //MessageBox.Show("Attach debugger!", "Viper.Setup");
        Cleanup();
        base.Uninstall(savedState);
    }

on the installer class doesn't seem to be called. Any ideas what could be the reason?

EDIT: I also noticed that it not only doesn't run the Installer, but also doesn't delete my main dll file. To make it worse, when I install a new version after uninstalling the previous one, this dll is still the old one (even though installation and uninstallation were successful)

A: 

Did you include the output of your installer code in the Code Actions tab of the installer?

If that's not it...

I ran into a similar problem in the past and found I needed all 4 methods defined or the uninstall would not run. Add your code to the template below:

[RunInstaller(true)]
public class MyInstaller: Installer
{
    public override void Install(IDictionary stateSaver)
    {
        base.Install(stateSaver);
    }

    public override void Commit(IDictionary savedState)
    {
        base.Commit(savedState);
    }

    public override void Rollback(IDictionary savedState)
    {
        base.Rollback(savedState);
    }

    public override void Uninstall(IDictionary savedState)
    {
        base.Uninstall(savedState);
    }
}

Hope this helps!

Hi, it didn't work :( Also, see my edit.
Grzenio
A: 

I stopped using these rubbish msi's and created a zip + cmd script instead. Strongly recommended, took me 10 times less to set up and actually works.

Grzenio
Do you handle uninstall, upgrade and rollback for all the modifications to the machine?
Rob Mensching
Yes, I implemented all of them
Grzenio