Redirect all output to temp file and exit with code 0 in the batch file. This will effectively ignore any errors from taskkill :
killit.bat:
taskkill /F /IM MyApp.vshost.exe > %temp%\out.txt 2>&1 exit /B 0
Now call killit.bat in the build event.
Refresh After Hege sent his answer, I thought that just pasting the code from the batch file into the build event should also work, because as far as I know, build events in VC are always executed on the command line anyway. And really
taskkill /F /IM MyApp.vshost.exe > %temp%\out.txt 2>&1 || exit /B 0
how the build event also works. However, redirection is still required.
stijn
source share