Question: Probably between 25 and 50% of the times I build my solution, I see this:

"[The operation you requested is taking longer than expected to complete. This dialog will close when the action completes.](https://i.imgur.com/UOtXUud.png)"

I hate this window in ways I can't describe. It never resolves, the Cancel button is never enabled, and the only way to remedy it is to kill the devenv process and load up my entire solution again, knowing full well that I've fixed nothing and I'm equally liable to see the same thing when I attempt my build.

My solution is about 60 projects in total, which are mostly C# class libraries, with a few each of web applications, web services, and console applications. However, the problem persists even when building one slice of the codebase with the majority (50) of the projects unloaded.

My problem is that the output windows doesn't tell me anything at the point at which it freezes, and I don't know how else to determine the cause of this lockup. If I were to guess, I would assume that it's a deadlock in the filesystem or something, but I don't know how to go about proving this--much less how to prevent it.

What can I do to diagnose and eliminate this from my solution so that I never see it again? In general, how can I diagnose problems that occur during a build?

Answer: 
In my case setting "maximum number of parallel project builds" to 1 kinda helped (i.e. building a project from clean state causes 1 min freeze followed by normal build and every subsequent build works fine). 

Aforementioned setting can be set in `Tool -> Options -> Projects and Solutions -> Build and Run`.
Seems like running Visual Studio as Administrator solved the problem for me! (For always running a program as Administrator see [How to Run Visual Studio as Administrator by default](https://stackoverflow.com/questions/9654833/how-to-run-visual-studio-as-administrator-by-default))