visual studio not remembering open documents & sta

2019-01-10 13:36发布

问题:

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

回答1:

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.



回答2:

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.



回答3:

In Visual studio 2015 :

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

It worked for me.

Happy coding :)



回答4:

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.



回答5:

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.



回答6:

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



回答7:

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



回答8:

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



回答9:

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



回答10:

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

Erasing the .suo file did not...



回答11:

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!



回答12:

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.