Reputation: 24729
When I run a build, sometimes I see a code change I forgot. So I want to cancel the build. Due to the build locking up my IDE, I have to use Ctrl+Break, however, it does not respond fast enough.
I am looking for a command line approach so I can just hit a batch file in my quick launch. I tried this command:
Taskkill /IM aspnet_compiler.exe /F
However, this only stops the current project from building and the next one in my multi-project solution starts up.
How can i cancel a build using command line?
Upvotes: 10
Views: 13257
Reputation: 9850
Actually we can also use the GUI of Resource Monitor to do it.
For example, when we compile a project, some files are occupied, such as "Unable to copy" bla bla.
Steps:
Task manager ->
Performance ->
Resource Monitor ->
Associated Handler ->
search "file name which is occupied."
The strength of this method is intuitive and no need to remember DOS commands, but the drawback of this is we need to search and operate several times.
Upvotes: 0
Reputation: 105
I have this bash script, with flare.
@echo off
REM by jnh from http://www.chris.com/ascii/index.php?art=objects/explosives
echo " _.--------------- "
echo " _-- --_ "
echo "- -) "
echo "| | "
echo " \._ _./ "
echo " ```--. . , . .--''' "
echo " | | | "
echo " .-=|| | |=-. "
echo " `-=#$$$$$#=-' "
echo " | ; :| "
echo " _____.,-#$$$$$#&#~,._____ "
echo NUKE IT ALLLLLLL
REM kills all MSBuild processes
taskkill /F /IM MSBuild.exe /T
REM Just holds command window open long enough to admire explosion.
timeout 1
Upvotes: 1
Reputation: 1
Go to the menu BUILD and then click in the option: CANCEL. tested in VS2013.
Upvotes: -2
Reputation: 827
I had to add the /t
flag in order to kill the entire MSBuild.exe
process tree. That is:
taskkill /im msbuild.exe /f /t
In my case, I start MSBuild.exe
from Gnu Emacs and for some reason Gnu Emacs isn't always able to kill the MSBuild.exe
if I want to restart it. I use this as a backup. I'm doing c++ in VS2010.
Upvotes: 26
Reputation: 24729
I have come up with a crude method which is working well for me.
I have the following batch script.
@echo off
echo KILL BILLd
for /L %%i in (1,1,10) do (
Taskkill /IM aspnet_compiler.exe /F
timeout 1
)
(Above, 10 = seconds)
I then make a shortcut of that batch script in the same folder which allows me to do the additional.
In VS2010, I have set up CTRL+SHIFT+B as my build all. (not rebuild).
For the shortcut and since my fingers usually are still hoving in the area when I see a forgotten code change. My batch shortcut key combo is CTRL+SHIFT+ALT+B.
Upvotes: 1
Reputation: 968
Unfortunately, Visual Studio is the compiler. aspnet_compiler is for compiling views, so that's why you see it spawn in the list.
You can verify by getting process explorer and looking at the process tree. You'll note devenv never spawns msbuild, csc, or any other compiler. But devenv does spike in CPU and I/O.
Upvotes: 1
Reputation: 78320
The following stops the builds for all projects, across all instances of Visual Studio:
taskkill /im msbuild.exe /f
Upvotes: 7