122

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

Berryl
  • 12,471
  • 22
  • 98
  • 182
  • 1
    Currently having this problem in VS2019, but only when having disloged windows from the main-VS-window. It then starts completly blank upon the next opening of the solution. – BotMaster3000 Mar 22 '21 at 11:22
  • I, too, am experiencing a blank opening in VS2019 only when I have a dislodged window. For example, when I use a dislodged window on a second monitor. – Matt Kleinsmith Apr 27 '21 at 21:18

19 Answers19

174

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.

David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
Dan F
  • 11,958
  • 3
  • 48
  • 72
  • 1
    Hmm, wild stab in the dark time. Disable nuget? Macros? Are those files source code controlled? Rogue devenv.exe that isn't quitting properly? Do you run the Solution Navigator from Productivity Power Tools and could it be futzing with your settings? Basically I have no more ideas, sorry :-) – Dan F Jul 16 '11 at 21:06
  • 1
    In my case it helped to delete reshaper's .sln.DotSettings.user file as well. – SilentNot Jul 01 '17 at 00:00
  • 3
    Same issues still occurred in Visual Studio 2019. Found the .suo & server folder, which I simply deleted, inside my project folder within .vs/ProjectNameFolder/v16/. – chri3g91 Mar 18 '21 at 08:41
  • 1
    VS2019, this worked for me. – BHP May 10 '23 at 17:40
73

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.

ThatShawGuy
  • 1,363
  • 1
  • 14
  • 27
  • 7
    Haha, 4.5 years after I answered this question I hit the opposite problem with Studio 2015, I needed to make it _forget_ what it had opened. Thanks @ThatShawGuy, your answer got me out of a bind :) – Dan F Mar 15 '16 at 07:44
  • @DanF just curious how did you make VS15 forget what it had opened? – michal krzych Aug 08 '16 at 07:35
  • 2
    @user12345 by deleting the contents of the .vs\SolutionName\v14\ folder as mentioned above. So, if your solution is called SolOne and is in D:\Src\SolOneFolder\SolOne.sln, delete everything out of D:\Src\SolOneFolder\.vs\SolOne\v14\ – Dan F Aug 13 '16 at 03:58
  • 1
    thanks. Just keep in mind deleting this file also resets any unloaded projects/files etc. – michal krzych Aug 15 '16 at 08:11
  • 3
    wow...still an issue with **Studio 2017**, you have to remove the `.suo` file from .vs\SolutionName\v15\ when VS gets stuck opening the same files. – SliverNinja - MSFT Jul 05 '17 at 15:01
  • I just ran into this problem again with Studio 2017. No combination of resetting/deleting config files has restored VS's ability to return the state of the last opened files. I know this is not the right outlet but I am just so upset right now. As a single dev this is interrupting my workflow so much, it's beyond frustrating. And what's worse - the problem seems to have worsened a lot with VS Professional as opposed to the community edition. Will try to uninstall all extensions now and see if this helps. :( – themightylc Jan 07 '18 at 09:42
  • 1
    same solution works for 2022 as well. this is the correct answer. – Vishal modi Nov 30 '22 at 03:55
29

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

Patrick
  • 501
  • 5
  • 6
  • This worked better for me than resetting all settings. I'm using VS Community 2017 v. 15.9.10 – loganjones16 Mar 28 '19 at 16:08
  • This one should be confirmed answer, isn't it? – Kirill Kostrov Jun 03 '19 at 12:56
  • This really worked! But if I open my stored procedure -> close my vs(2019) ->reopen it, all the files open will be closed. If the stored procedure is not there before I close vs the documents/files will be opened. Is this normal? – paraJdox1 Jan 12 '21 at 06:46
27

In Visual studio 2015 :

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

It worked for me.

Happy coding :)

KAPIL SHARMA
  • 609
  • 7
  • 4
17

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.

John Callahan
  • 171
  • 1
  • 2
  • 3
    Same here. Only "Reset all settings" works after trying so many different things. For my VS2013 "Reset all settings" is under TOOLS > "Import and Export settings..." – Hong Jul 29 '15 at 18:37
  • This was already set. Then I disabled, restart VS and set again. Everything was fine. – Tzwenni Mar 21 '21 at 06:04
15

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.

meldim
  • 1,116
  • 1
  • 9
  • 9
10

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

Eduard Bakeš
  • 176
  • 2
  • 11
7

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

user3158765
  • 71
  • 1
  • 1
7

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.

Rafa Ayadi
  • 101
  • 1
  • 3
6

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

Oļegs
  • 61
  • 1
  • 1
  • I didn't wanted to Reset all settings so I tried all other solutions before. Reset Window Layout worked for me! Running VS 2015 Pro – Markus Sep 14 '16 at 11:53
6

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

mammadalius
  • 3,263
  • 6
  • 39
  • 47
5

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!

Nik
  • 1,780
  • 1
  • 14
  • 23
3

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

csharpdev
  • 31
  • 1
2

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

Erasing the .suo file did not...

LeoM
  • 41
  • 1
  • 4
  • Same problem. After going through the settings one by one I noticed it was caused by the Window Layout setting. You can import the defaults from Visual C# (or whatever you prefer) and keep the rest. – The Cookies Dog Sep 04 '17 at 08:40
0

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.

0

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

marcaldo
  • 59
  • 4
0

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.

BrownPony
  • 575
  • 4
  • 12
0

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

felix
  • 1
-1

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