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

后端 未结 7 2373
你的背包
你的背包 2021-02-18 16:05

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

相关标签:
7条回答
  • 2021-02-18 17:00

    I dont think there is an option for this (or I couldnt find one) but you could probably write a macro to do this for you on project open.

    This link has some code to close open files which you could adapt: http://blogs.msdn.com/djpark/

    I couldnt find the answer to this particular question but a good link for ide tips and tricks is: http://blogs.msdn.com/saraford/default.aspx

    0 讨论(0)
  • 2021-02-18 17:01

    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.

    0 讨论(0)
  • 2021-02-18 17:02

    VS attempts to save the last known view. Other than the scripts mentioned above you can manually close all documents before exiting VS

    0 讨论(0)
  • 2021-02-18 17:07

    ALT-W-L

    That's the key combination to close all open tabs, which can be pressed before closing a project, unless you prefer clicking Window | Close All Documents before closing the project.

    --Gus

    0 讨论(0)
  • 2021-02-18 17:08

    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.

    0 讨论(0)
  • 2021-02-18 17:10

    Alternative answer:

    Before you close your solution, press and hold Ctrl+F4, until all windows have been closed.

    0 讨论(0)
提交回复
热议问题