Resolved Hi , problem with updated my app

sarita54

Member
Joined
May 31, 2022
Messages
10
Programming Experience
Beginner
Hi , I try to update my app , with a .msi installer from a update button in my app
For that , I need to kill my current app before the installation :
C#:
            Process process = new Process();
            process.StartInfo.FileName = "Update.msi";
            process.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\MyAppFile\";
            process.StartInfo.UseShellExecute = true;
            process.Start();
            process.WaitForExit(60000);
            Process proc = new Process();
            ProcessStartInfo info = new ProcessStartInfo()
            {
                FileName = "CMD.exe",
                Arguments =
            "/C taskkill /im MyApp.exe /f  /t",
                CreateNoWindow = true,
            };
            proc.StartInfo = info;
            proc.Start();
The installer open well , just can't finish the installation because the app is not killed , and if i remove the waitforexit , the app killed but also the installer
Could someone help me please?
 
Last edited by a moderator:
Think about it:
1. If you need your current running application to end, then just stop running. Why invoke another process to kill the current running application?
2. Most installation programs are unable to update applications that are currently running. So why are you trying to run an installer while you are running?

The most common technique is to have a stub updater application. You invoke the stub and stop yourself. The stub waits for the main app to stop running before it runs the installer.

Another technique is to put a task in the Windows task scheduler to run X seconds in the future. You then kill yourself. The Windows installer will then run the scheduled task shortly thereafter. That task will run the installer.
 

Latest posts

Back
Top Bottom