Trying out PowerCommands 1.1 for Visual Studio 2008(转)
Posted on 2008-04-23 23:28 江南白衣 阅读(477) 评论(0) 编辑 收藏 举报原文:http://blogs.microsoft.co.il/blogs/bursteg/archive/2008/04/13/trying-out-powercommands-1-1-for-visual-studio-2008.aspx
Trying out PowerCommands 1.1 for Visual Studio 2008
Generally, I don't like to install any Visual Studio extensions at all, but I thought I should give this one a chance. I installed PowerCommands 1.1 for Visual Studio 2008, and went to play with the new functionality. Here is what I found as the most useful:
PowerCommands in Options dialog
Under Tools -> Options, you can find the PowerCommands Node, and change settings. You can set some general settings such as "Format document on save" and enable or disable any of the additional commands.
Format document on save / Remove and Sort Usings on save
What a helpful option! I turned it on immediately!
Before |
After |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } } } |
using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } } } |
Collapse Projects
Sometimes I still can't understand how this command never made it into the Visual Studio IDE. This command collapses a hierarchy in the solution explorer starting from the root selected node. It can be executed from three different places: solution, solution folders and project nodes respectively.
So simple, so helpful!
Undo Close Pane
Ever closed a file in Visual Studio and then had hard time to find it back? With the new Undo Close Pane, you don't have to worry any more. This pane tracks all the documents that you close, and lets you reopen then in a single click.
To reopen the last document that was closed, you can use Ctrl+Shift+Z.
Copy / Paste References
In large solutions you can find yourself adding references to a lot of projects over and over again. Now, you can select a single or a set of references, copy them to the clipboard, and then paste them to another project.
Additionally, you can copy a project as a reference and later paste as a reference to another project. This will add a project reference to the selected project.
Other Helpful Commands
- Clear All Panes
This command clears all output panes. It can be executed from the button on the toolbar of the Output window.
- Copy Path
This command copies the full path of the currently selected item to the clipboard. It can be executed by right-clicking one of these nodes in the Solution Explorer:
The solution node; A project node; Any project item node; Any folder.
- Show All Files
This command shows the hidden files in all projects displayed in the Solution Explorer when the solution node is selected. It enhances the Show All Files button, which normally shows only the hidden files in the selected project node.
- Email CodeSnippet
To email the lines of text you select in the code editor, right-click anywhere in the editor and then click Email CodeSnippet.
- Insert Guid Attribute
This command adds a Guid attribute to a selected class. From the code editor, right-click anywhere within the class definition, then click Insert Guid Attribute.
- Copy Class
This command copies a selected class entire content to the clipboard. It can be executed from a single project item or a project item with dependent sub items.
- Paste Class
This command pastes a class entire content from the clipboard. It can be executed from a project or folder node.
- Edit Project File
This command opens the MSBuild project file for a selected project inside Visual Studio. It can be executed from a project node.
- Open Containing Folder
This command opens a Windows Explorer window pointing to the physical path of a selected item. It can be executed from a project item node
- Open Command Prompt
This command opens a Visual Studio command prompt pointing to the physical path of a selected item. It can be executed from four different places: solution, project, folder and project item nodes respectively.
- Unload Projects
This command unloads all projects in a solution. It can be executed from the solution node.
- Reload Projects
This command reloads all unloaded projects in a solution. It can be executed from the solution node.
- Remove and Sort Usings
This command removes and sort using statements for all classes given a project. It can be executed from a solution node or a single project node.
Note: The Remove and Sort Usings feature is only available for C# projects since the C# editor implements this feature as a command in the C# editor (which this command calls for each .cs file in the project).
- Extract Constant
This command creates a constant definition statement for a selected text. It can be executed from the code window over a selected text.
- Clear Recent File List
This command clears the Visual Studio recent file list.
- Clear Recent Project List
This command clears the Visual Studio recent project list.
- Transform Templates
This command executes the associated custom tool with text templates items. It can be executed from a DSL project node or a folder node.
- Close All
This command closes all documents. It can be executed from a document tab.
Summary
The PowerCommands collection can improve the development experience and I recommend downloading and start using it. If you want to see those commands in action, you can download Deppak Kapoor's video about them.
Looking for the next drops of this collection!
Enjoy!