Search
Enterprise

Visual Studio 2010 IDE : Customizing Visual Studio 2010

Published 3 min readBy Programming4us Editorial Team
Extensibility is not the only way of customizing the IDE. You can personalize existing features such as the Tools menu, menu commands, and toolbars. In this section you learn how to customize both the Tools built-in menu and toolbars to add functionalities to the environment.

Customizing the Tools Menu

You can customize the Tools menu by providing additional commands pointing to external executables. This is particularly useful if you need to run an external tool against an element within the solution or project. You provide additional commands by selecting Tools, External Tools. This launches the External tools dialog where you can specify the executable name and parameters. For example, imagine you want to add a custom command for launching the Microsoft IL Disassembler for the executable generated by the current project. If you already have any tools in the list (such as the Dotfuscator tool), the first step is clicking the Add button. Then follow these steps:

1.

In the Title text box, write IL Disassambler.

2.

In the Command text box, write the full path for ILDasm.exe. (Generally it is under the Windows SDK tools directory,)

3.

For the Arguments box click the arrow on the right and select Target Path (the related variable is $(TargetPath)). This variable represents the executable generated by the compilation process.

Figure 1 shows the result of this editing. Click OK so that the new command will be added to the Tools menu.

Figure 1. Setting command properties in the External Tool dialog.


Now try to open any existing project and build it; then select the new Tools, IL Disassembler command. If no errors occur, you will see IL Disassembler run and analyze the executable produced by the current project.

Customizing Commands and Toolbars

Visual Studio enables customizing other aspects of the IDE such as menus (including context menus) and toolbars. The next subsections cover both scenarios with examples.

Customizing an Existing Toolbar

Imagine you want to add another button to the Standard toolbar, such as the Close Solution command. Select Tools, Customize. When the Customize dialog displays, select the Commands tab. Then select the Toolbar item and from the related combo box pick up the Standard toolbar. Now the goal is adding a button, so click Add Command. This launches the Add Command dialog; here you just select the menu where the command is located (on the left) and the command itself (on the right). Select File on the left and Close Solution on the right. Figure 2 shows the result of this step.

Figure 2. Selecting the command to be added to the standard toolbar.


When you click OK, the command is added to the desired toolbar, as demonstrated in Figure 3. In the Customize dialog simply click Move Up or Move Down to place the command in the preferred position.

Figure 3. Arranging the command position in the toolbar.


Simply click Close to return to the IDE. You see the command appearing on the Standard toolbar.

Creating a New Custom Toolbar

To create a new custom toolbar, follow these steps:

1.

Select Tools, Customize and make sure that the Toolbars tab is selected.

2.

Click the New button, so that the New Toolbar dialog appears. When ready, type the CustomBar name into the dialog text box and click OK (see Figure 4).

Figure 4. Adding a new custom toolbar.


3.

Select the Commands tab and in the Toolbar combo box, select the CustomBar toolbar; Figure 5 shows how the Customize dialog looks at this particular point.

Figure 5. Preparing the new toolbar for customization.


4.

Click Add Command and follow the instruction explained in the previous section to add as many commands you want in the new toolbar. Figure 6 shows an example.

Figure 6. Configuring the new custom toolbar.


At this point the new toolbar is available in the IDE. To remove it, simply right-click one of the existing toolbars and unselect the new one from the pop-up list.