MSI creation: Terminate application before upgrading

1.5k views Asked by At

I'm using Microsoft Visual Studio 2010 to create a simple .MSI installer for my simple .EXE application.

Trouble is, things go wrong (until a reboot) if you install an upgrade while the .EXE is still running.

I'd like for the .MSI installer to terminate my process before installing/upgrading.

Please could someone tell me how to do this in Orca?

EDIT: I've seen this occur due to my .EXE being in use, but I've also seen it because the .CHM help file was open at time of upgrade as well, so any process termination alone is not enough to solve this problem.

3

There are 3 answers

1
Cosmin On

You can try creating a custom action which stops your application (a custom EXE or DLL written by you). For example you can send WM_CLOSE to the main application window (your application should handle this message).

This custom action should be scheduled before InstallValidate action in InstallExecuteSequence table.

4
Ciprian On

You should ad the MsiRMFilesInUse Dialog to your installer.

0
hogwell On

You could write a custom action that closes your application as well as your help file.

You should be able to find the window handles for both of these by using FindWindow: http://msdn.microsoft.com/en-us/library/ms633499(v=vs.85).aspx

For the executable, you should be able to use the appropriate Window Class or Title for FindWindow. For the help file, you should be able to use the appropriate Help Window Title for FindWindow.

I hope this helps!