Visual Studio 2010 Beta 2 : How to add an external tool (MSBuild script) to a Visual Studio button

I’m a real fan of MSBuild Scripts, I always use a lot of MSBuild Tools in my projects (for example scripts that automatically get latest version of the code, compile, check-in, …).

The easier way I found to execute those scripts is to run them automatically while I am clicking on a button into my Visual Studio.

image

STEP 1: Creation of an external tool

In Visual Studio 2010, Click on “Tools” menu, “External Tools …”.

A pop-up appears, click Add button and enter the desired information.

image

“Title” textbox is used as the name of the button that will be created.

If you use MSBuild on a X64 operating System, you have to select x86 MSBuild version:

C:\Windows\Microsoft.NET\Framework\v4.0.21006\MSBuild.exe

Click on “Use Output window” checkbox to redirect the result of your MSBuild script into Visual Studio Output window.

Step2 : Creation of your Toolbar and affectation of the external tool

On the menu bar, right click and select “Customize …”.

image

A pop-up appear, create your desired toolbar. Name it MyToolbar and click OK.

image 

Click on the “Commands” tab and click on ToolBar radio button to select the newly created external tool.

image

Select MyToolBar and click on “Add Command …” button.

image

On the left lit item, select “Tools” and than select the “External Command x” item where X is the index of your tool that appears in the “Tool” menu (starting index => 1). In my example “External Command 6”.

image

Click “Ok” and than “Close”.

And here is the result :-)

image

Comments

  • Anonymous
    June 10, 2011
    Thanks for the info on this--couldn't figure out how to add External Tools to the toolbar!
  • Anonymous
    January 08, 2013
    How can we set icon on the command ?
  • Anonymous
    May 15, 2014
    Hi Jeff, you have install add-on , please follow this link. blogs.msdn.com/.../command-image-changing-extension.aspx