Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill a process from WiX

Tags:

process

kill

wix

I am developing an installer using Wix and need to kill a process (not application) silently during installation so the user doesn't get a pop up asking to kill the process or wait and restart. I have seen solutions for killing an application but not a process.

like image 864
patrickbadley Avatar asked Jul 11 '12 19:07

patrickbadley


2 Answers

After some digging around I found this solution which uses the WixUtilExtension Quiet Execution Custom Action http://wix.sourceforge.net/manual-wix3/qtexec.htm:

<InstallExecuteSequence>
  <Custom Action='MyProcess.TaskKill' Before='InstallValidate'/>
</InstallExecuteSequence>

<Property Id="QtExecCmdLine" 
          Value='"[WindowsFolder]\System32\taskkill.exe" /F /IM MyProcess.exe'/>
<CustomAction Id="MyProcess.TaskKill" 
              BinaryKey="WixCA" 
              DllEntry="CAQuietExec" 
              Execute="immediate" 
              Return="ignore"/>

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="WindowsFolder" Name="WINDOWS"/>
    ...
like image 156
patrickbadley Avatar answered Nov 20 '22 09:11

patrickbadley


I have used the CloseApplication element to do this, if I understand your needs. The processes I killed don't show as applications in Task Manager. Depends on what process class you're talking about, though.

like image 5
Ben Mosher Avatar answered Nov 20 '22 07:11

Ben Mosher