How do I cancel a build that is in progress in Visual Studio?

Visual Studio-2010

Visual Studio-2010 Problem Overview


Almost unconsciously I hit the keyboard build macro that builds my entire solution. This can happen just as I notice a code change. The build dominates my computer, and I basically have to wait till it finishes. 10 seconds!

How can I cancel a build?

Visual Studio-2010 Solutions


Solution 1 - Visual Studio-2010

You can hit Ctrl+Break on the keyboard to cancel/stop a build that is currently in progress.

Solution 2 - Visual Studio-2010

Go to Visual Studio Build Menu -> cancel build , easy :)

enter image description here

Solution 3 - Visual Studio-2010

This is crude, but it works well. The Visual Studio on one of my projects (I turn MVC view building on to catch markup errors), well, the project becomes unresponsive while building. I can't cancel the build using the keyboard shortcuts.

So I made this batch file that sits on my quick launch task bar.

@echo off
echo KILL BILLd
for /L %%i in (1,1,10) do (
   Taskkill /IM aspnet_compiler.exe /F
   timeout 1
)

I also made the batch file launch minimized. The build stops and Visual Studio just throws in the error window that there was a problem building.

Solution 4 - Visual Studio-2010

Ctrl + Break works, but only if the Build window is active. Also, interrupting the build will sometimes leave a corrupted .obj file that will have to be manually deleted in order for the build to proceed.

Solution 5 - Visual Studio-2010

If all else fails go to task manager and kill the msbuild task under Visual Studio 2017

Solution 6 - Visual Studio-2010

Ctrl + End works for me on Visual C++ 2010 Express.

Solution 7 - Visual Studio-2010

Visual Studio 2015 Professional Update 3

If you are using Mac you can do following

Click Build --> Cancel from the Visual Studio Menu

or

Select Azure App Service Activity window --> Cancel it will cancel the publish activity.

Solution 8 - Visual Studio-2010

I'm using Visual Studio 2015. To stop build you can follow:

  1. Ctrl + Pause
  2. Ctrl + Break

Solution 9 - Visual Studio-2010

The "pause" command was a function button underneath my right shift key, so the below combination of keys did the trick for me.

Ctrl + Fn + Shift

Solution 10 - Visual Studio-2010

I was hit by an unresponsive build and absolutely nothing would allow me to either kill or cancel the build. Even trying to end the task would trigger a user input window, saying that it could not be ended while the build is still going on (quite ironic because that was precisely the intention, to leave that broken state).

The build was taken care of by MSBuild, so the one way I found is to end its task. When forcing MSBuild.exe to end, VS will wake up and finally see the build as cancelled, allowing you to work again.

Hope this helps someone in the same situation.

Solution 11 - Visual Studio-2010

The build context menu has a Cancel build in Visual Studio 2013.

Solution 12 - Visual Studio-2010

Go to the Window menu and choose "Web Publish Activity" There will be a cancel button. Cancel button on "Web Publish Activity" tab

Solution 13 - Visual Studio-2010

For users of Lenovo Thinkpad T470s like me, you can simulate the break key by hitting Ctrl+Fn+P, which cancels the build.

Solution 14 - Visual Studio-2010

If you do not have a break key on your keyboard, you can change the keyboard shortcut to cancel the build.

Just search hotkeys in the search menu. This should take you to Environment > Keyboard. From there, search for Build.Cancel and you can change it to whatever keyboard shortcut ( eg. Ctrl+Alt+End ). This is a good keyboard shortcut because it won't conflict with other uses of Ctrl+End or Ctrl+Shift+End .

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionValamasView Question on Stackoverflow
Solution 1 - Visual Studio-2010Chris SubagioView Answer on Stackoverflow
Solution 2 - Visual Studio-2010darmisView Answer on Stackoverflow
Solution 3 - Visual Studio-2010ValamasView Answer on Stackoverflow
Solution 4 - Visual Studio-2010Mark HoltenView Answer on Stackoverflow
Solution 5 - Visual Studio-2010Adam SeabridgeView Answer on Stackoverflow
Solution 6 - Visual Studio-2010kgsmithView Answer on Stackoverflow
Solution 7 - Visual Studio-2010Iyyappan AmirthalingamView Answer on Stackoverflow
Solution 8 - Visual Studio-2010ThanhView Answer on Stackoverflow
Solution 9 - Visual Studio-2010Isaac AdamsView Answer on Stackoverflow
Solution 10 - Visual Studio-2010Frederik.LView Answer on Stackoverflow
Solution 11 - Visual Studio-2010jacobsgriffithView Answer on Stackoverflow
Solution 12 - Visual Studio-2010Ray KorenView Answer on Stackoverflow
Solution 13 - Visual Studio-2010SkeirdView Answer on Stackoverflow
Solution 14 - Visual Studio-2010trinalbadger587View Answer on Stackoverflow