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

后端 未结 7 2526
你的背包
你的背包 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: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.

提交回复
热议问题