views:

49

answers:

2

My VS 2008 created installer doesn't call the override Uninstall method in my installer class. why? The Install method was called. My installer class looks like this:

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

            //encrypt connection string
            encryptConntStr();

            //create database
            createDatabase();
        }

        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);
            System.Diagnostics.Debugger.Break();
            MessageBox.Show("I am in Uninstall now.");
            string exePathStr = Context.Parameters["targetdir"];
           ...           

        }
}

EDIT: alt text

A: 

have you added a custom action for uninstall?

in the setup project

Petoj
This is what I didn't understand. I thought the Uninstall method will be called automatically and I can do something inside that method (delete files) just like what I did in Install method. I have to create a separated Custom Action and add that Custom Action to the Uninstall Custom Action of the setup project. Is that right? Does that mean the Uninstall method is useless? what's the relationship between the Uninstall method and the new uninstall custom action? I will search online to see how to do that. thanks.
5YrsLaterDBA