无论如何,加载解决方案时是否要告诉Visual Studio不要打开所有文档? [英] Is there anyway to tell Visual Studio not to open all the documents when I load solution?

查看:72
本文介绍了无论如何,加载解决方案时是否要告诉Visual Studio不要打开所有文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2008(或此版本的更早期版本)中打开解决方案时,它将打开在关闭Visual Studio之前未关闭的所有文档.无论如何,有没有关闭此功能,或者有修复此问题的插件?加载一个打开了50个文件的解决方案需要花费永远的时间?

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 anyway to turn this functionality off, or a plugin that fixes this behavior? It takes forever to load a solution with 50 files open?

推荐答案

在关闭解决方案之前,您可以通过为EnvDTE.BeforeClosing事件添加处理程序来自动化关闭所有文件的过程-这将被调用VS退出时.

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.

在VS2005中,将以下内容添加到EnvironmentEvents宏模块将关闭所有打开的文档:

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似乎支持相同的事件,所以我相信这也可以使用.

Visual Studio 2008 appears to support the same events so I'm sure this would work there too.

如果可以的话,我确定您也可以在处理程序中删除项目的.suo文件,但是您可能希望使用AfterClosing事件.

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.

这篇关于无论如何,加载解决方案时是否要告诉Visual Studio不要打开所有文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆