Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cancel Visual Studio build using command line?

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?

like image 558
Valamas Avatar asked Mar 01 '12 04:03

Valamas


2 Answers

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.

like image 94
Tom Weiss Avatar answered Sep 18 '22 12:09

Tom Weiss


The following stops the builds for all projects, across all instances of Visual Studio:

taskkill /im msbuild.exe /f
like image 25
Fraser Avatar answered Sep 21 '22 12:09

Fraser