79

When the Visual Basic compiler (Vbc.exe) crashes, Visual Studio fails to detect this and becomes stuck in an inoperable state. The "Build" menu appears as it would if the solution were building, but the Cancel Build (Ctrl+Break) menu item has no effect. Trying to close the application or the solution gives the error:

The build must be stopped before the solution can be closed.

I can't find any way to remedy this short of terminating the devenv.exe process and restarting Visual Studio completely. Is there anything quicker and less severe?

(Microsoft claims to have fixed this bug in 2005, but I'm experiencing it with VS2008.)

11
  • 3
    I experienced the same issue. I also had to shut down the process
    – Jeremy
    Jul 19, 2011 at 15:02
  • 6
    I wouldn't call terminating the devenv.exe process "severe". I call it a routine task when using Visual Studio in all versions unfortunately. Usually everything is saved before a build so what's the big deal? Aug 17, 2011 at 17:49
  • 3
    Wow, if you're over VPN and lose 10 minutes on a VS crash, why don't you build via the command line? Visual Studio won't have build problems if you don't use it to build :) Aug 31, 2011 at 17:34
  • 3
    Still the case in VS2012 too Jul 31, 2013 at 6:43
  • 2
    ... and in VS2013 as well.
    – Nolonar
    Aug 18, 2014 at 15:29

10 Answers 10

57

I'd look for msbuild process(es) to kill before devenv. And make sure vbc really has gone too.

And as the comments say, try using msbuild yourself.

Seeing as I've got a Nice Answer badge from this, I feel I should emphasise my comment below: In all the cases where this has happened to me there have been no msbuild or vbc processes to kill. If anyone gave or gives me a +1 because they did find a stuck msbuild or vbc process, please comment that this was the case too.

7
  • And, of course, if you can produce a small project that repeatedly crashes vbc please report it to connect.microsoft.com whatever version you're using; though make sure you have all your Windows Updates up to date.
    – Mark Hurd
    Mar 26, 2012 at 14:38
  • Thanks for the ideas, Mark et al. I'm no longer with the employer that had me on the VPN set up, so I can't test these suggestions. I would say there's something unappealing about being the only developer using a non-standard build process (we made a web app with a lot of time-sensitive, complex builds, so communication was important) and the notion of "accept it as part of life" seems like an ugly Windows-culture compromise. Thanks for trying though.
    – duozmo
    Mar 28, 2012 at 0:07
  • 14
    Ctrl+Break or Go to Visual Studio 2013 Build Menu -> cancel build , that easy. reference Hope helps someone.
    – Shaiju T
    Jul 20, 2016 at 9:23
  • 1
    This happened to me today in Visual Studio 2015. The build cannot be cancelled. I usually work with 3 or more solutions opened at once, in separate VS windows. Today I had 5 or 6, so as I usually do in similar situations, I shut the functional windows down properly, then killed the bad one (End Process) when it was the only one left. The interesting thing I noted today was that I had 4 MSBuild.exe processes running, though there was no build running in the other windows. As I closed each other window, those MSBuild.exe processes all ended, leaving none actually associated with the dead window. Jul 21, 2016 at 16:39
  • 1
    That msbuild was my issue. Stopped it in tasked manager. If some don't see it, make sure the check box at bottom(show all processes) is checked, just in case its hidden. Mine was not hidden. Jul 7, 2017 at 18:35
15

You can use a shortcut ctrl+break in VS, this should cancel build process.

0
9

I see this error in Visual Studio 2013 Professional as well. I terminated devenv.exe through Task Manager.

4
  • I get it with VS2015 as well, in the build menu Cancel is not available which makes since since I have no build in progress. going to task manager killing VS and restarting works around, but this is painful... Oct 28, 2016 at 9:40
  • Painful yes, but it does work. I must admit, since posting this, I've had much less occurrence of this happening, if any. The issue resolved after I reinstalled. Oct 31, 2016 at 9:51
  • This isn't a good solution, since the underlying build process will still be running.
    – Sneftel
    May 11, 2018 at 15:38
  • It's used as a last resort, that said this issue doesn't occur for me anymore. May 13, 2018 at 7:15
9

For Visual Studio 2015 or greater, in Menubar, under Build option, there is "cancel" option. This will stop the build.

2
  • 9
    The reason we're here is because that didn't stop the build :p Jun 18, 2020 at 7:43
  • in VS2022 that button is not there anymore
    – GuidoG
    Oct 27, 2022 at 9:32
3

S O L V E D it!

Had this problem in VS2017 prof vs15.9.16. When performing a build, build starts to compile but never finishes. Build-menu items are grayed out except for 'cancel'. And cancel does not work. Using a different compiler worked! 'Kill process' was the only way to kill the build.

Stripping the program to its bare minimum showed the real problem. There where referenced DLL's that hung the build. Compiling the DLL's and re-referencing them solved the problem.

1
  • I know this is an old answer and an even older question, but can you speak a bit more on the final rwo lines about referenced DLL's being the issue? This whole problem for me was also trigger by messiness with the DLL's but even though I have stripped them out and completely turned off the functionality that needed them, the build hanging remains. For me its always hanging on the GenerateTemporaryTargetAssembly build task. I am in a similar situation as well, I am on vs17 prof 15.9
    – Narish
    May 2 at 19:33
2

I had this problem arise in VS2015. You can specifically kill the MSBuild.exe process without shutting down Visual Studio.

2

taskkill /IM devenv.exe /F worked for me

1

sometime this problem also arise in VS2015. Following the same process (kill process) would work here too.

1

I had this today whilst using VS2019 (16.4.2). I my case I started a publish - it was a database project - and changed my mind so cancelled the publish using Ctrl+Break. The build showed as completed successfully, and the publish did not start. Publish was greyed out and I could not exit VS because of this error. I had no msbuild or vbc processes running. My solution was to kill the devenv process.

1

Still happens in VS 2022. .Net host process gets stuck while building project with version conflict dependencies. Resolving those conflicts helps and build proceeds, but again, the question is why dotnet process is getting stuck on it remains.

Another potential solution might be clearing nuget content in C:\Users\YourWindowsUserName\.nuget folder and rebuilding solution in freshly cloned repo location, or deleting .vs folders across all solution projects.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.