wix3.5 - Wix: how to forcefully kill a process/task? -
i need forcefully kill process running in background before attempting delete files, when running uninstall msi created wix. main application consist of trayicon reflects status of bg-process monitoring local windows services (made on c#, though may not relevant going further).
i first tried following:
<file id='fooexe' name='foo.exe' source='..\source\bin\release\foo.exe' vital='yes' /> ... <installexecutesequence> <custom action="closetray" before="installvalidate" /> </installexecutesequence> ... <customaction id="closetray" execommand="-exit" filekey="fooexe" execute="immediate" return="asyncwait" />
the tray icon closed after confirming application-close dialog, foo.exe task still appears on taskmgr after uninstall completed. also,the following error message given:
thats why, tried this:
<installexecutesequence> <custom action="foo.taskkill" before="installvalidate" /> </installexecutesequence> ... <customaction id="foo.taskkill" impersonate="yes" return="asyncwait" directory="windir" execommand="\system32\taskkill.exe /f /im foo.exe /t" />
after obtaining same result, tried:
<property id="qtexeccmdline" value='"[windir]\system32\taskkill.exe" /f /im foo.exe'/> ... <installexecutesequence> <custom action="myprocess.taskkill" before="installvalidate" /> </installexecutesequence> ... <customaction id="myprocess.taskkill" binarykey="wixca" dllentry="caquietexec" execute="immediate" return="ignore"/>
sample took here: how kill process wix
lately when else failed, tried without success:
<wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/utilextension"> ... <installexecutesequence> <custom action="wixcloseapplications" before="installvalidate" /> </installexecutesequence> ... <util:closeapplication id="closefoo" closemessage="yes" description="foo still running!" elevatedclosemessage="yes" rebootprompt="yes" target="foo.exe" />
this 1 gave me different error:
i'm thinking on building statue in honor process refuses die!!! ... either or think problem on application side exists, should add application.exit(); or environment.exit(0); @ line inside program.cs.
is there other thing @ either wix or application attempt closing @ uninstall? thanks!
personally think best option go in-built closeapplication
method rather previous options.
the error getting (error code 2762) because trying schedule action in immediate sequence have elevatedclosemessage="yes"
set triggers deferred action. either remove attribute or schedule in deferred sequence.
Comments
Post a Comment