Visual Studio 2010 PowerCommands扩展
这个周末,微软在在线陈列室中发布了免费的Visual Studio 2010 PowerCommands扩展。你可以在这里了解相关详情,可以通过上面的“扩展管理器”(查询 PowerCommands即可)下载和安装它。
PowerCommands扩展在Visual Studio 2010中添加了数十个有用的的命令。下面是它往解决方案管理器上下文菜单中添加的几个有用命令的屏幕截图:
下面是这个周末发布的Visual Studio 2010 PowerCommands扩展中包含的全部命令的列表:
-
Enable/Disable PowerCommands in Options dialog(在选项对话框中启用和禁止PowerCommands)
这个特性允许你选择在Visual Studio IDE中启用哪个命令。指向工具菜单,然后点击选项。展开PowerCommands选项,然后点击Commands,对你想启用的命令打勾。
注:所有的PowerCommands初始是默认启用的。
- Format document on save / Remove and Sort Usings on save(在保存时格式化文档/对using语句进行删除和排序)
保存时对文档进行格式化这个选项可以格式化被保存文档的tab,空格等等。这个命令等同于执行编辑菜单,单击高级选项,然后点击格式化文档。对using语句进行删除和排序选项在被保存的文档中删除未利用的using语句,对剩下的using语句进行排序。
注: 对using语句进行删除和排序选项只限于C#文档。在保存时格式化文档/对using语句进行删除和排序这2个命令初始时默认为OFF。
- Clear All Panes(清除所有方框)
这个命令清除所有输出方框,可从输出窗口工具条上的按钮来执行。
- Copy Path(拷贝路径)
这个命令把当前选择的个项拷贝到剪贴板上。可以右击方案管理器中下述节点执行:
方案节点; 项目节点; 任何项目个项节点; 任何目录节点。
- Email CodeSnippet(邮寄代码片段)
想邮寄在代码编辑器中被选中的文本,在编辑器中右击任何地方,然后点击Email CodeSnippet(邮寄代码片段)。
- Insert Guid Attribute(插入Guid特性)
这个命令在选中的类中加一个Guid特性,在代码编辑器中,在类的定义中右击任何地方,然后点击Insert Guid Attribute(插入Guid特性)。
- Show All Files(显示所有文件)
这个命令在方案节点被选中时,显示方案管理器中所有项目中隐藏的文件。它增强了Show All Files(显示所有文件)按钮,该按钮一般只显示选中项目节点中的隐藏文件。
- Undo Close(取消关闭)
这个命令重新打开一个被关闭的文档,将光标返回到最后的位置。要重新打开一个最后被关闭的文档,指向编辑菜单,然后点击Undo Close(取消关闭)。或者,你可以用 CtrlShiftZ 快捷键。
要重新打开最近被关闭的其他文件,指向视图菜单,点击其他窗口,然后点击Undo Close Window(取消关闭窗口)。取消关闭窗口出现,一般是靠近输出窗口。双击列表中的任何文件,重新打开。
- Collapse Projects(折叠项目)
这个命令从被选中的根节点开始,折叠方案管理器中的一个项目或多个项目。将一个项目折叠可以增加方案的可读性。这个命令可从三个不同的地方执行:分别是方案节点,方案目录节点和项目节点。
- Copy Class(拷贝类)
这个命令将一个选中的类的全部内容拷贝到剪贴板上,并且重新命名类名。这个命令之后一般会接着执行Paste Class(粘贴类)命令,并且将类重新命名以免编译错误。可从单个项目个项或带着子个项(sub items)的项目个项(project item)执行。
- Paste Class(粘贴类)
这个命令从剪贴板处粘贴过来一个类的全部内容,将类重新命名以免编译错误。这个命令之前跟着Copy Class(拷贝类)命令执行的。可从项目或目录节点执行。
- Copy References(拷贝引用)
这个命令将一个引用或多个引用拷贝到剪贴板上。可以从总引用节点(references node),单个引用节点,或者多个引用节点执行。
- Paste References(粘贴引用)
这个命令从剪贴板处粘贴过来一个引用或多个引用。可根据项目类型,从不同的地方执行。对C#项目,可从总引用节点执行。对Visual Basic 和 网站项目,可从项目节点执行。
- Copy As Project Reference(拷贝为项目引用)
这个命令将一个项目作为项目引用拷贝到剪贴板上,可从项目节点执行。
- Edit Project File(编辑项目文件)
这个命令打开Visual Studio中所选项目的MSBuild项目文件,它结合了现有的Unload Project(卸载文件)和Edit Project(编辑项目)命令。
- Open Containing Folder(打开父目录)
这个命令打开一个Windows资源管理器窗口,指向所选项的物理路径,可从项目个项(project item)节点执行。
- Open Command Prompt(打开命令行)
这个命令打开一个 Visual Studio 命令行,指向所选项的物理路径,可从4个地方执行,分别是解决方案节点,项目节点,目录节点和个项(item)节点。
- Unload Projects(卸载项目)
这个命令卸载一个解决方案中的所有项目。这在MSBuild有多个项目正被编辑的场景中会非常有用。这个命令可从方案节点执行。
- Reload Projects(重新装载项目)
这个命令重新装载一个解决方案中所有卸载了的项目,可从方案节点执行。
- Remove and Sort Usings(对using进行删除和排序)
这个命令对给定项目中所有类中的using语句进行删除和排序。例如,对由向导(wizard)生成的using语句进行删除或组织是非常有用的。这个命令可以从一个方案节点或单个项目节点来执行。
- Extract Constant(提取常数)
这个命令针对所选择的文本创建一个常数定义语句。有效地提取常数,对一个明文值命名,能提高可读性。这个命令可以在代码编辑器中,通过右击选择的文本来执行。
- Clear Recent File List(清除最新文件列表)
这个命令清除Visual Studio的最新文件列表,该命令调出一个清除文件对话框,允许选择任何一个或所有最新的文件。
- Clear Recent Project List(清除最新项目列表)
这个命令清除Visual Studio的最新项目列表,该命令调出一个清除文件对话框,允许选择任何一个或所有最新的项目。
- Transform Templates (转换模板)
这个命令执行与文本模板项相关的定制工具,可以从DSL项目节点或DSL目录节点执行。
- Close All (全部关闭)
这个命令关闭所有文档,可以从文档页(tab)执行。