Why does it take sooo long to load my solution in Visual Studio?

Visual Studio-2010Visual StudioVisual Studio-2012AnkhsvnProductivity Power-Tools

Visual Studio-2010 Problem Overview


We have a really big solution with more than 200 projects and thousands of files. Despite of that the solution used to load pretty quickly in Visual Studio 2010 as well as 2012. However, after copying the whole SVN repository to another location, loading and closing the solution suddenly took extreeeemly long. (I am talking about 30-60 minutes here!)

Visual Studio-2010 Solutions


Solution 1 - Visual Studio-2010

I found a solution myself and I wanted to share it here, hoping that it might save someone quite a few hours of research and staring at the "Preparing solution..." dialog.

When inspecting the devenv.exe process with Process Monitor, I found out that it is pretty busy with accessing the .svn directory. Here is what I did (and this somehow solved the problem):

  1. Kill Visual Studio
  2. Open Visual Studio without loading a solution
  3. Disable AnkhSvn as Source Control plugin (Tools->Options->Source Control->Plug-in Selection->None)
  4. Disable "Document Well 2010 Plus" (VS2010) or "Custom Document Well" (VS2012) in Productivity Power Tools (Tools->Options->Productivity Power Tools) - I read that somewhere and it might have helped as well...
  5. Close Visual Studio
  6. Delete the solution's *.suo file. This is located in the same folder as the solution itself. NOTE: You will lose several settings for your solution, like currently opened files, breakpoints, bookmarks, current solution configuration & platform (e.g. Debug x86) etc.
  7. Restart Visual Studio
  8. Load the solution - it was much faster now!
  9. Close Visual Studio
  10. Open Visual Studio without loading a solution
  11. Re-enable AnkhSvn and the "Document Well"
  12. Restart Visual Studio
  13. Open the solution - it was still loaded in seconds!

I do not know which of these steps actually solved the problem. Probably, not all these steps are required, but I did not want to reproduce the problem to find out which steps may be omitted. :)

Solution 2 - Visual Studio-2010

None of those helped me, what I did... I watch with ProcMon of sysinternals, filtering for devenv, and I saw a lot of entries of fussionlog. I had enabled fussionlog for debugging purposes some weeks before and didn't think in disabling it. I just had to disable fussionlog and the solution opened faster.

Solution 3 - Visual Studio-2010

You can open the Visual Studio in the Safe Mode, and then check your plugin and source control settings after opening the project. Safe Mode means "Starts Visual Studio, loading only the default environment and services."

How :

devenv /SafeMode 

Or according to your path

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" /SafeMode

source : https://msdn.microsoft.com/en-us/library/ms241278.aspx

Solution 4 - Visual Studio-2010

In my case, the following worked without any of the intervening steps suggested:

  1. Kill Visual Studio.
  2. Start Visual Studio directly (i.e., not from the .sln file).
  3. Then, from within Visual Studio, open the solution.

In my case this was all it took to make the problem solution load quite quickly, without the need for me to change any settings or delete any files.

Solution 5 - Visual Studio-2010

fwiw, I realize this is a late entry, but I found that simply removing (deleting) my large number of breakpoints resolved the excessive load time and compile time. This action reduced the size of the .suo file from 214MB to 977KB. Let VS handle the .suo file itself. Compiling and loading now takes < 1 minute instead of 5-10 minutes for a solution with 35 projects. Visual Studio 2012 Pro, update 4.

Solution 6 - Visual Studio-2010

None of the other answers worked for me. CI compile times were fine, but loading my solution in Visual Studio was taking almost two minutes. VS would then operate just fine until I closed and opened the solution the next time. Different versions of VS all showed the same problem and both safe mode and deleting the suo didn't help.

I ended up following the advice in http://geekswithblogs.net/akraus1/archive/2014/04/30/156156.aspx to use Windows Performance Recorder to instrument VS and find the problem. By looking in Windows Performance Analyzer under the "CPU Usage (Sampled)" section and adding the "Stack (Frame Tags)" column, I was able to dig into the usage of devenv.exe.

Turns out the hot path by count had Microsoft.VisualStudio.Platform.WindowManagement.ni.dll 23 calls down, and below that eventually Microsoft.VisualStudio.ServerExplorer.dll and Microsoft.VisualStudio.Data.Package.dll. That pointed me to look in Server Explorer in the UI and open the Data Connections tab. There I found hundreds of mistakenly added connections that came from the debug web.config's ConnectionString section. Removing those from web.config reduced the load of that individual project from 90+ seconds to almost instant.

Solution 7 - Visual Studio-2010

I have a different cause for the slow loading of the projects.

My situation is utilizing Git and found that even switching branches was slower than it should be with project load.

Solution: Run Visual Studio as Administrator

Reason: Something with the Corporate laptop is not providing the needed Git tool access (it doesn't recognize that a git repository is in use).

I have not seen any issues with Git or my personal access to any of the project files or Git objects.

Solution 8 - Visual Studio-2010

I tried the above, but it didn't solve my problem.

Here's how I got around this problem, hopefully it will work for some of you as well:

  1. Open Visual Studio 2013 with no solution.
  2. Create a new C# Console application and save it.
  3. Close Visual Studio.
  4. Reopen the Console solution created in step 2.
  5. Close Visual Studio.
  6. Reopen the solution that was previously hanging on the Preparing Solution dialogue. Mine opened right away, no more hanging.

Solution 9 - Visual Studio-2010

Using Visual Studio 2015, I ended up creating a new solution, adding the existing projects.

Deleting the *.suo from gehho's answer helped in the past, but didn't help me in this case. There's also another .suo file in a hidden .vs folder at the root of the solution.

There are other answers here for Visual Studio 2015 https://stackoverflow.com/q/34395686/292060

Solution 10 - Visual Studio-2010

For my case it was due to TFS issue. It thinks that there are more than 5000 pending changes.

The fix is to force TFS to recheck. Go to Team Explorer -> Source Control Explorer and do "Get Latest" on the projects that have pending changes. For things that are already matching TFS, Visual Studio will actually not download anything to your PC. For things that are different with TFS, Visual Studio will let you know and ask you to reconcile the difference.

This is VS 2019 Professional.

Solution 11 - Visual Studio-2010

I encountered this problem only recently (Mar 2021), using VS 2019. It literarily takes 30+ seconds to load the file (each). It only effects the Layout files. I believe it could be to do with the links within the files. I have not had time to investigate them. However, I am writing this to suggest that regardless of the cause of the problem, a simple solution is to right click on the file and open it with Notepad to get your work done.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiongehhoView Question on Stackoverflow
Solution 1 - Visual Studio-2010gehhoView Answer on Stackoverflow
Solution 2 - Visual Studio-2010FranciscoView Answer on Stackoverflow
Solution 3 - Visual Studio-2010Tarek El-MallahView Answer on Stackoverflow
Solution 4 - Visual Studio-2010Reg EditView Answer on Stackoverflow
Solution 5 - Visual Studio-2010jafoView Answer on Stackoverflow
Solution 6 - Visual Studio-2010Jeremy MurrayView Answer on Stackoverflow
Solution 7 - Visual Studio-2010he_the_greatView Answer on Stackoverflow
Solution 8 - Visual Studio-2010Yves RochonView Answer on Stackoverflow
Solution 9 - Visual Studio-2010goodeyeView Answer on Stackoverflow
Solution 10 - Visual Studio-2010bobtView Answer on Stackoverflow
Solution 11 - Visual Studio-2010user12282614View Answer on Stackoverflow