Open the solution and Visual Studio expands all projects automatically, how to solve

Lionsure 2020-07-28 Original by the website

Sometimes I don't know where I changed it, so every time I open the solution, Visual Studio expands all projects automatically, and the file opened last time is not automatically opened. When there are many projects, all projects are expanded, which makes the solution explorer too long, and it is inconvenient to find files. Every time you have to manually collapse the projects one by one, it seems very troublesome. Fortunately, a solution was found.

 

I. Quick steps

Open the project → collapse the unused items → open the file you want to open → delete the ".suo" file → close the solution → open the solution again → return to normal.

 

II. Detailed steps

1. Open the solution with Visual Studio(VS2005, 2008, 2010 and 2012 are all available).

2. Collapse the rarely used items and open the file being edited.

3. Delete the ".suo" file(under the root directory of solution, the same directory as the "solution name.sln"), the file is hidden, if it is not found, just display all files.

4. Close the solution, and then reopen it. At this point, the project that was collapsed just now is not automatically expanded, and the opened file is automatically opened. When you open the solution and find that there is no ".suo" file, Visual Studio will automatically recreate one.

 

Related description:

The ".suo" file is the abbreviation of Solution user option. It is used to save the custom configuration of the user interface, including layout, breakpoints, and files that were compiled at the end but not closed, so that these can be restored when opened with Visual Studio next time.