ChatGPT解决这个技术问题 Extra ChatGPT

Visual Studio stuck at "build must be stopped before the solution can be closed"

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.)

I experienced the same issue. I also had to shut down the process
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?
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 :)
Still the case in VS2012 too
... and in VS2013 as well.

M
Mark Hurd

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.


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.
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.
Ctrl+Break or Go to Visual Studio 2013 Build Menu -> cancel build , that easy. reference Hope helps someone.
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.
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.
G
Grengas

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


M
Mike Upjohn

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


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...
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.
This isn't a good solution, since the underlying build process will still be running.
It's used as a last resort, that said this issue doesn't occur for me anymore.
R
Rohil Patel

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


The reason we're here is because that didn't stop the build :p
T
Ton

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.


A
Abhay Dixit

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


R
Ryan

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


N
Nathan Scott

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.


S
Sergio

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 why dotnet process is getting stuck on it.


This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review