Visual Studio open files question

后端 未结 9 1947
野性不改
野性不改 2020-12-05 07:08

Is it possible to open a project in Visual Studio 2008 without opening all the files that were previously opened last time I had the project open. I have a habit of keeping

9条回答
  •  旧巷少年郎
    2020-12-05 07:17

    A bit of research turns up the fact that you can do it with a macro:

    • Create a new macro (or use an existing one). You should see a module called EnvironmentEvents in Macro Explorer. (For details, see here.)
    • Open the EnvironmentEvents module.
    • Put in this code:

      Public Sub CloseDocsOnExit() Handles SolutionEvents.BeforeClosing
          DTE.ExecuteCommand("Window.CloseAllDocuments")
      End Sub
      
    • Save and Build the macro.
    • Open a whole bunch of documents in your solution, then close Visual Studio.
    • Yay! No more open documents!
    • (Note: Despite that it says SolutionEvents, it also works if you're working on a project that doesn't have a solution.)

提交回复
热议问题