duozmo
duozmo

Reputation: 1788

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

Upvotes: 83

Views: 62023

Answers (10)

kudoku
kudoku

Reputation: 329

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.

Upvotes: 1

Marjo Kaci
Marjo Kaci

Reputation: 41

taskkill /IM devenv.exe /F worked for me

Upvotes: 4

Nathan Scott
Nathan Scott

Reputation: 76

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.

Upvotes: 1

Jay Patel
Jay Patel

Reputation: 151

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

Upvotes: 7

Ton
Ton

Reputation: 329

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.

Upvotes: 3

Ryan
Ryan

Reputation: 31

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

Upvotes: 3

Abhay Dixit
Abhay Dixit

Reputation: 1018

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

Upvotes: 1

Grengas
Grengas

Reputation: 1054

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

Upvotes: 19

Mark Hurd
Mark Hurd

Reputation: 10931

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.

Upvotes: 60

Mike Upjohn
Mike Upjohn

Reputation: 1297

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

Upvotes: 9

Related Questions