visual studio not remembering open documents & startup project

Visual StudioVisual Studio-2010

Visual Studio Problem Overview


For the past week, something has changed about my VS solution, and I havent found a setting to fix it yet.

When I close the solution and restart:

  1. the start-up project reverts to a different one than was selected when I last closed
  2. my project heirarchy is not what it was when it closed - every project is expanded
  3. the documents that were open when closed are all closed

In each case I want the solution to look just like it did when I closed it last.

How do I make that happen?

Cheers,
Berryl

Visual Studio Solutions


Solution 1 - Visual Studio

I believe this information all lives in your .suo file and/or .user file. If they've become corrupt, VS will struggle, so it'll revert to the default.

Maybe try exiting VS, deleting the .suo and/or .user files, start VS and set it up how you want, restart it again and see if it remembered the settings.

Solution 2 - Visual Studio

I ran into this problem in Visual Studio 2015. Removing the .suo file in the solution root did not fix the problem. I needed to remove everything under the following directory:

>\\SolutionRootFolder\.vs\FolderWithSolutionName\v14\

.vs is a hidden folder and .suo is a hidden file under the v14 folder that must be deleted along with the vbcs.cache folder.

Update for VS2017: The problem still exists in VS2017 with the v15 folder.

Solution 3 - Visual Studio

This doesn't address the startup project issue, but checking the "Reopen documents on solution load" checkbox fixed the remembering open documents issue for me.

You can change that setting here:

Tools -> Options -> Projects and Solutions -> General -> Reopen documents on solution load

Not sure if that checkbox existed before I upgraded Visual Studio 2017 to version 15.8.3 or if it got reset somewhere along the way

Solution 4 - Visual Studio

In Visual studio 2015 :

Tools -> Import and Export Settings -> Reset all settings

It worked for me.

Happy coding :)

Solution 5 - Visual Studio

I had the same problem and tried removing the .suo file. However, that did not fix the project. I then tried the 'reset' option which worked perfectly.

Solution 6 - Visual Studio

I had the same problem with Visual C# express.

The only way I found to solve the problem was to:

  1. reset the settings (Tools -> Settings -> Reset)
  2. exit studio
  3. delete the old corrupted .suo files from the solutions affected.

It looks like a VS bug since Express versions don't support any plug-ins anyway. I noticed that after I would delete the .suo file and reopen visual studio it would generate a new .suo file for that particular solution which would normally be around 57k. If I would open any file in the environment and then close visual studio (even if that file was not part of the solution at all) it would save a .suo which was around 916k. After that, opening that same solution would cause the problem described above.

Solution 7 - Visual Studio

In Visual Studio 2015 >> Tools > Options > Enviroment > Startup > At startup > Load last loaded solution

Solution 8 - Visual Studio

For Visual Studio 2017, Tools->Import and Export Settings-Reset All Settings did it for me after trying all other solutions as proposed.

Solution 9 - Visual Studio

I solved this problem in Visual Studio 2010 Professional by invoke main menu command "Windows->Reset Window Layout"

Solution 10 - Visual Studio

Tried all of the above. Nothing worked. What worked for me (VS2017) is just going to my repo folder, show hidden files, delete the .vs folder and restart VS.

Solution 11 - Visual Studio

Visual Studio 2015 Enterprise: As for many people in this thread, deleting the .suo file did not help, so I resorted to resetting all settings...which worked. I did not want to wipe out all of my settings, so I spent a bit of time to see which setting was causing it (note: still cannot find it in options).

So, to fix the issue while keeping most of your setting intact, follow these steps:

  1. Tools -> Import and Export Settings...
  2. Select "Export Selected Settings" -> Next. Check all checkboxes.
  3. Expand "General Settings"
  4. [Important] Uncheck "Window Layouts". -> Next -> Finish.
  5. Back to: Tools -> Import and Export Settings...
  6. Reset all settings -> Next -> just reset all settings.
  7. Now import the settings file you exported in Step 4

Now you will have retained almost all of your settings, and fixed the problem. All you have to do now is move your pallets around to what you like and you're done!

Solution 12 - Visual Studio

Delete the .vs (Hidden) folder from the solution path and reopen the Visual Studio. It happens when updating the Visual Studio.

Solution 13 - Visual Studio

For Visual Studio 2019 version 16.9.2, this problem occurs if you open a detached code window. Even if you close the detached code window before exiting Visual Studio, when VS restarts, no code windows are reopened.

This occurs regardless of whether you've deleted your "Solution User Options" (.suo) file or whether Tools->Options->Projects and Solutions->General: "Reopen documents on solution load" is checked.

It's slated to be fixed in version 16.10, hopefully.

Edit: The VS dev community source ticket below denotes this issue is fixed in VS 16.9.6 and 16.10 Preview 1: https://developercommunity2.visualstudio.com/t/Visual-Studio-not-restoring-prior-open-d/1317364

Solution 14 - Visual Studio

In Visual Studio 2017 the Tools -> Import and Export Settings -> Reset all settings worked perfectly for me.

Erasing the .suo file did not...

Solution 15 - Visual Studio

Even I solved this problem in Visual Studio 2015 Professional go to "Windows->Reset Window Layout" First i tried deleting .user/.suo file, but it was not wark out for me .Last i got solution like above.

Solution 16 - Visual Studio

For Visual Studio 2017 v15 go to Tools -> Options -> Project and solutions and chech "Reopen documents on solution load".

Solution 17 - Visual Studio

So nothing here fixed it for me. I am in VS 2015. Everything was find until I moved everything over to Windows 10. I did a reinstall of VS and started it up. It asked me what basic settings I wanted and I choose General. None of the projects I migrated over would remember their open windows. Sucked.

I followed every single bit of advice here and nothing worked. Worse even on Windows 7 it was carrying over.

So I decided to purge my settings and reset. When I did I was prompted with a dialog box to choose which default collection of settings I wanted. I chose visual c# and that fixed the problem instantly.

The initial problem was caused by my choosing "General" settings....

I have not tried the other settings. YMMV.

Solution 18 - Visual Studio

The only way I found to solve the problem was to:

reset the settings (Tools -> Settings -> Reset) exit studio delete the old corrupted .suo files from the solutions affected.

it works for me

Solution 19 - Visual Studio

Just close VS and delete .suo file then reopen VS and try

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
QuestionBerrylView Question on Stackoverflow
Solution 1 - Visual StudioDan FView Answer on Stackoverflow
Solution 2 - Visual StudioThatShawGuyView Answer on Stackoverflow
Solution 3 - Visual StudioPatrickView Answer on Stackoverflow
Solution 4 - Visual StudioKAPIL SHARMAView Answer on Stackoverflow
Solution 5 - Visual StudioJohn CallahanView Answer on Stackoverflow
Solution 6 - Visual StudiomeldimView Answer on Stackoverflow
Solution 7 - Visual StudioEduard BakešView Answer on Stackoverflow
Solution 8 - Visual Studiouser3158765View Answer on Stackoverflow
Solution 9 - Visual StudioOļegsView Answer on Stackoverflow
Solution 10 - Visual StudioRafa AyadiView Answer on Stackoverflow
Solution 11 - Visual StudioNikView Answer on Stackoverflow
Solution 12 - Visual StudiomammadaliusView Answer on Stackoverflow
Solution 13 - Visual StudiocsharpdevView Answer on Stackoverflow
Solution 14 - Visual StudioLeoMView Answer on Stackoverflow
Solution 15 - Visual StudioHozrot AliView Answer on Stackoverflow
Solution 16 - Visual StudiomarcaldoView Answer on Stackoverflow
Solution 17 - Visual StudioBrownPonyView Answer on Stackoverflow
Solution 18 - Visual StudiofelixView Answer on Stackoverflow
Solution 19 - Visual StudioMostafa BedoorView Answer on Stackoverflow