This issue came to me today at work where two devs said they couldn’t add a new view to a project. I repro’d it right away and began investigating.
The problem was isolated to one project in the solution. I compared references between projects and compared the underlying project files. Each change that I made to bring them closer into alignment didn’t help.
As said many times, the trick to successful debugging is isolation. So I unloaded every project except for the web project being tested. The Add dialogs loaded immediately. So at this point, I had a workaround. The projects referenced by the web project (only one) could be unloaded when a new view or controller was needed.
Although this was a workaround, it’s hardly a solution. I continued down that path of figuring out why the MVC Add dialogs were causing VS to hang.
At one point, I was researching online and I noticed that the Add Controller dialog did appear. It took over 5 minutes to get to that point, but it did show. So I tried the Add View dialog and it eventually did show as well. The dropdown list for model classes was populated with every class from the referenced project. That might have been the cause of the slowdown.
Something about the dialog struck me funny. They were different between the two projects. This suggested to me that they were using different libraries. I loaded up the NuGet package manager between the two projects and saw the functional project used Razor v2.0, but the failing project used v3.2.3.
I downgraded the failing project to Razor 2.0. This caused a new problem. I no longer had context menu options to directly add controllers or views. Fortunately, I knew where to go for this fix.
In the project file is a node called ProjectTypeGuid, which tells VS what menu options to provide. I could see the non-working project was missing one of the guids. I quick copy between the projects restored the context menu options.