
This is the twenty-third article in a series on the release of VS 2010 and .NET 4.
Today's article will tell about the extensibility improvements made in VS 2010, for example, the new cool extension - PowerCommands, which saw the light just a few days ago (it is absolutely free).
Extensibility in VS 2010
VS 2010 is a richer model for extensibility than previous versions. Any developer can create an extension that can add new functionality, customize Visual Studio 2010 IDE, code editor, project system, and associated designers.
')
VS 2010 extensions can be created using the new
MEF technology
(Managed Extensibility Framework) , which is integrated in .NET 4. You can learn more details on how to create extensions for VS 2010 in the
article from the Visual Studio team .
VS 2010 Extension Manager
Developers who create extensions can distribute them in any way: through their own sites or selling.
Visual Studio now comes bundled with an IDE extension manager that allows developers to search, download and activate extensions online. You can download the extension manager via the Tools-> Extension Manager menu:
You will see a dialog box that provides access to the online gallery from Microsoft, with a list of available extensions, any of which can be downloaded and activated on your copy of Visual Studio:
You will find hundreds of cool extensions provided by online galleries. You can filter them by category (use the category tree on the left side of the window). By clicking “download” on any extension you - download, install and activate it.
PowerCommands for Visual Studio 2010
This week, Microsoft released the free PowerCommands extension for Visual Studio 2010. You can read more about it
in the gallery and install it through the “Extension Manager”, as shown above.
PowerCommands adds tons of useful commands and trifles to Visual Studio 2010. Below is a screenshot of just a few useful commands that the extension adds to the context menu of the Solution Explorer:
Below is a list of all available commands in this release:
- Turn on / off PowerCommands in the Options window . This feature allows you to choose which commands will be active in the Visual Studio IDE. Go to the Tools-> Options menu, expand the PowerCommans item, then select Commands. Specify which commands you want to enable. By default, all commands are active.
- Formatting a document while saving / Deleting and sorting usings when saving. Allows you to format when saving bookmarks, spaces and the like. It is equivalent to Edit-> Advanced-> Format Document. Removing and sorting usings allows you to remove unused namespaces and sort the remaining ones, available only for C # documents. By default, this feature is disabled .
- Cleaning all panels. Allows you to clear all output panels. You can start the button on the Output window panel.
- Copy path. The command copies the full path of the currently selected item to the clipboard. Called by right-clicking a node in Solution Eplorer.
- Email snippet. To send a few lines of code by mail, you just need to select the necessary lines, right-click on them and select “Email CodeSnippet”.
- Insert guid attribute. Allows you to easily add a guid-attribute to the selected class. In the code editor, right-click anywhere in the class definition, then “Insert Guid Attribute”.
- Show all files. Displays all hidden files in all projects present in Solution Explorer when the solution node is selected. In fact, it expands the capabilities of the standard Show All Files feature, which displays hidden files only for the selected project.
- Cancellation close. Reopens the closed document and returns the cursor to the last position. To reopen the last closed document, go to the menu Edit-> Undo Close or press the key combination Ctrl + Shift + Z. To reopen any closed document, go to View-> Other Windows-> Undo Close Windows. The Undo Close window appears, usually next to the Output window. Double clicking on any document in the list will reopen it.
- Minimize projects. This command collapses all projects in Solution Explorer starting from the root of the selected node. Minimizing the project can increase the readability of the solution. The command is called from three different places: solutions, solution folders and project nodes.
- Copy class. Copies the contents of the selected class to the clipboard, changing the class name. Next, use the Paste Class, which renames the class to avoid compilation errors. It can be called for a single project element or a project element with dependent sub-elements.
- Insert class. Inserts the contents of the selected class from the clipboard, renames it avoiding compilation errors. This command is preceded by a Cope Class.
- Copy links. Copies links or set of links to the clipboard.
- Insert links. Inserts a link or set of links from the clipboard. Called from various places, depending on the type of project. For C # projects, invoked from the reference node. For Visual Basic or web projects, you can call directly from the project site.
- Copy as project reference. Allows you to copy a project as a project link to the clipboard.
- Editing the project file. Opens an MSBuild project file for the selected project in Visual Studio. Unites existing Unload Project and Edit Project.
- Open the containing directory. Opens the Windows file viewer along the path of the selected item. Called from any element of the project.
- Open command prompt. Opens the Visual Studio command line pointing to the physical path of the selected item. You can call in four different ways: solution, project, folder and project element in Solution Explorer.
- Uploading projects. Unloads all projects in the solution. Convenient when in MSBuild scripts, when multiple projects are being edited.
- Reload projects. Overloads all unloaded projects in the solution.
- Remove and sort bys. Removes and sorts using-expressions for all classes in the project. Very useful, for example, in the generation of using'ov setup wizards.
- Extract Constant. This command creates a constant declaration for the selected text. Extracting constants increases the efficiency of naming alphabetic values, which leads to improved readability. The command can be invoked by right-clicking on the selected text in the code editor, then Extract Constant.
- Clear recent open files. Clears the list of recently opened Visual Studio files.
- Cleaning newly opened projects. Clears the list of recently opened Visual Studio projects.
- Template conversion. The command runs a custom tool with associated textual patterns of elements. May be called from a DSL site of a project or folder.
- Close all. Closes all documents through the document tab.
How to temporarily disable extensions
Extensions provide a great way to make Visual Studio an even more powerful tool and increase productivity. Only one BUT should be remembered, all extensions are launched
inside the Visual Studio
process (DevEnv.exe), therefore any extension error can affect the stability and performance of Visual Studio.
If you ever find yourself in a situation where things are slower than they should, or if IDEs are constantly falling, you should temporarily disable any installed extension and check if this resolves the problem. For installed extensions, you can do this in the online gallery by opening the extension manager (menu Tools-> Extension Manager), selecting the “Installed Extensions” node in the upper left part of the window, selecting “Disable” from any extension in the list:
