Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 "Add View" dialog takes a long time to load

In VS 2013, when I right click the solution explorer and go to Add > View... the whole IDE locks up for a very long time - approximately 20 seconds. After this time period, the "Add View" dialog finally appears and everything returns to normal.

  1. Why does this happen? It's such a simple dialog. All I want to do is add an empty view, which is, essentially, an empty text file.

  2. How can I speed it up?

n.b. It's worth noting that I have a pretty quick computer with a fast SSD. Most operations in VS are very, very quick - it's just this dialog.

like image 992
theyetiman Avatar asked Nov 13 '14 14:11

theyetiman


2 Answers

One of the things that opening that dialog does is it looks for an Entity Framework model and uses those entities to populate the dialog with auto creation templates (to create shell pages for CRUDL type operations) on an entity type. To do this it seems to do a sort of in-memory build (i.e. it doesn't seem to output anything to the file system). I have found in the past that if you don't have a particularly simple entity model it has a hard time; in an earlier version if your entity context did not have a parameterless constructor it would fail outright.

I have only used the Add > View dialog for making the list views and such for entities. For everything else I use the Add > MVC 5 View Page (Razor). it doesn't connect to your entities, or do anything beyond adding a cshtml page to your Solution Explorer.

like image 95
CodeWarrior Avatar answered Nov 20 '22 05:11

CodeWarrior


As a work-around, I tend to copy and paste and existing view and then trim as required. Rubbish I know, but so much faster. The the slowness has been an issue for years!

like image 33
Sam Shiles Avatar answered Nov 20 '22 05:11

Sam Shiles