Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anyway to tell Visual Studio not to open all the documents when I load solution?

When you open a solution in Visual Studio 2008 (or ealier versions for that matter), it opens all the documents that you did not close before you closed Visual Studio. Is there anyway to turn this functionality off, or a plugin that fixes this behavior? It takes forever to load a solution with 50 files open?

like image 719
Jesper Blad Jensen Avatar asked Sep 29 '08 09:09

Jesper Blad Jensen


People also ask

What is the difference between project and solution in Visual Studio?

A project is contained within a solution. Despite its name, a solution is not an "answer". It's simply a container for one or more related projects, along with build information, Visual Studio window settings, and any miscellaneous files that aren't associated with a particular project.

How do I see all open files in Visual Studio?

Getting Started. After installing, select [View] -> [Other Windows] -> [Working Files List] on the menu bar within Visual Studio. Any open documents should be listed in the tool window.

What is the purpose of Solution Explorer in Visual Studio?

You can use Solution Explorer to create & manage your solutions and projects and to view & interact with your code.


3 Answers

Have you tried deleting the .suo file?

It's a hidden file that lives beside your solution (sln) file. suo is "solution user options", and contains your last configuration, such as what tabs you left open the last time you worked on the project, so they open again when you reload the project in Visual Studio.

If you delete it, a new 'blank' suo file will be recreated silently.

like image 152
Galwegian Avatar answered Oct 20 '22 04:10

Galwegian


You can automate the process of closing all the files prior to closing a solution by adding a handler for the BeforeClosing event of EnvDTE.SolutionEvents -- this will get invoked when VS is exiting.

In VS2005, adding the following to the EnvironmentEvents macro module will close all open documents:

     Private Sub SolutionEvents_BeforeClosing() Handles SolutionEvents.BeforeClosing         DTE.ExecuteCommand("Window.CloseAllDocuments")     End Sub 

Visual Studio 2008 appears to support the same events so I'm sure this would work there too.

I'm sure you could also delete the .suo file for your project in the handler if you wanted, but you'd probably want the AfterClosing event.

like image 23
Steve Beedie Avatar answered Oct 20 '22 06:10

Steve Beedie


From Visual Studio 2017 Update 8 there is an option in projects and solutions which you can use to enable this:

enter image description here

like image 42
Sam Holder Avatar answered Oct 20 '22 06:10

Sam Holder