Why is my Uninstall method not being called?

My created VS 2008 installer does not call the override method Uninstallin my installer class. What for? The method is called Install. My installer class is as follows:

[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

+3
source share
1 answer

make sure the CustomActionData property is not empty. Some of them were empty in my case and cause this problem.alt text

+3
source

Source: https://habr.com/ru/post/1772126/


All Articles