Uninstall a application during installation not working

后端 未结 3 988
时光取名叫无心
时光取名叫无心 2020-12-21 03:59

I am developing WPF application in C#. Currently my msi install the current application in machine.I need to uninstall two supporting application of existing version during

3条回答
  •  执笔经年
    2020-12-21 04:56

    sorry to be the one with the bad news... but:

    when installing / uninstalling a program from any modern windows-based machine - there is no way to start more then 1 instance of the installation wizard (in short: the msiExec)

    that is why it works great on other parts of your project - because no calls for the msiExec are made at those points

    and now for the good news: you can send the unistall command with a delay, or even better - start a timer that asks every X seconds if the installation is over. when the installer will complete, you will be able to make the unistall commands. something like this:

            timer = new System.Timers.Timer(2 * 1000) { Enabled = true };
    
            timer.Elapsed += delegate(object sender, System.Timers.ElapsedEventArgs e)
            {
    
            }
    
            timer.Start(); // finally, call the timer
    

提交回复
热议问题