Question

I have a WIX install program.

When I test my install program on a machine where the old version of the software is running, I get the prompt below.

The problem is that the installer can't manage to close the application. When the new program runs, it complains about the old one running.

Is there a way to forcefully kill the app? If not, is there some entry in WIX that will require the user to shutdown the application before it will continue installation?

enter image description here

Was it helpful?

Solution

I found the answer here:

WiX <util:CloseApplication> element not working

I made one tweak to the solution in the post above. I kill the application earlier in the install sequence so the window above doesn't appear.

<!-- Code to force termination of running program...MSIExec couldn't do it -->
<Property Id="QtExecCmdLine" Value='"[WindowsFolder]\System32\taskkill.exe" /F /IM "$(var.ProductName).exe"'/>
<CustomAction Id="APP.TaskClose" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore"/>
<InstallExecuteSequence>
    <Custom Action="APP.TaskClose" After="LaunchConditions"/>
</InstallExecuteSequence>

If you are wondering what "$(var.ProductName).exe" is, I pass the exe name on the commandline because I'm creating several branded versions of the same program. Just substitute your exe name.

And yes, it is safe in this particular intance to do this. There is no data held in memory that could be lost.

OTHER TIPS

You should use the WiX util extension CloseApplication:

http://wixtoolset.org/documentation/manual/v3/xsd/util/closeapplication.html

That should work.

Long term you should get the app integrated with Restart Manager so it will shut down automatically.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top