Did you know… You can run external tools within Visual Studio? – #201

It’s the External Tools Tip of the Day series!!

Okay I have to admit, I’m not the local expert in External Tools, so I could really use help with examples.  I can talk about the functionality all day long, but nothing is better than real world examples.

Let’s start with the basics.  Go to Tools – External Tools to bring up the External Tools dialog.  You’ll notice a set of built-in tools ready to go for you.

Tools - External Tools

Note that I circled the list of external tools.  This list maps directly to the list presented in the Tools menu, as shown below.

External tools listed on Tools menu

The first time I made this connection I was taken aback.  I probably saw this list of tools for years, but never knew it came directly from the External Tools dialog.

Technorati Tags: VS2005Tip,VS2008Tip

Comments (8)

  1. I have a bunch of External Tools set up.  Some examples are invoking MSBuild for a custom build file and getting the strong-name signature for a signed (and compiled) project.

  2. > but never knew it came directly from the External Tools dialog

    You mean there’s a human being behind this blog? :-)

  3. MarcT says:

    I have several of the TF Power Tools linked there, such as Branch History and Blame/Annotate. It’s easy to set the arguments to the currently active file, so it’s almost like they’re built in.

    The other tip is to assign them keyboard shortcuts, which is a pain because they show up there as "External Tool 1", and I’ve got do figure out which tool that means.

  4. Chris Martinez says:

    One of my personal favorite uses of "External Tools" is setting up the CScript debugger to automatically start debugging scripts directly from Visual Studio .NET.

    Admittedly, I’ve shifted most of my scripting to PowerShell these days, but there is still the occasional need for JScript and/or VB Script.  Debugging standalone scripts is usually a pain.  Using the "External Tools" dialog you can make it a snap!

    Steps to setup the CScript debugger to launch and debug your script directly from Visual Studio:

    1) In Visual Studio, Tools -> External Tools

    2) Click "Add"

    3) Title = CScript Debugger

    4) Command = C:WindowsSystem32cscript.exe

    5) Arguments = //NOLOGO //X "$(ItemPath)"

      NOTE: The $(ItemPath) VS Marco maps the path to

      the script you currently have open

    6) Initial Directory = "$(ItemDir)"

      NOTE: The $(ItemDir) VS Marco maps the directory

      to the script you currently have open.  This

      addresses path resolution if your script relies

      on external files located in the same relative


    7) Check "Use Output Window"

    8) Click OK

    If you want to get even fancier, you can add a custom toolbar button (and/or toolbar) and attach the external command to it.  Essentially, you can make a "Run" button just like you have for other .NET code.

    To debug a script, open any compatible script in Visual Studio.  For example (HelloWorld.js):

    function main()


       WScript.StdOut.WriteLine( "Hello world!" );



    Now either click Tools -> CScript Debugger or your fancy toolbar button.  The Visual Studio "Just-In-Time Debugger" dialog will pop up.  Select the current instance you are using.  (I’ve never figured out how to automatically select the current running instance of VS.NET as the debugger, but that would be a nifty addition).  The debugger will break on the first executable line of code in the script.  Debugging can resume using all of the typical Visual Studio .NET debugging features.

    You’ll also notice that since the "Use Output Window" is checked, the standard output is directed to Visual Studio.  If you open the Output Window (View -> Output) and change the option in "Show output from" to "CScript Debugger", you will see all of the redirected output.  In this case – "Hellow world!".

    Happy scripting and debugging!

  5. Gregor Suttie says:

    Ben’s blog shows you an example such as you mentioned – in this case how to run subsonic from the VS IDE




  6. Ben Hall says:

    Thanks for point that out Gregor.

    Readers might also be interested in this post about executing unit testing frameworks


  7. Mike Adams says:

    This is my favorite external tool: Windows Explorer


    I also set a keybinding, so I can select the file from the solution explorer, press CTRL + M, CTRL + E and see the file in Explorer. This is extremely handy for batch files in the solution and editing the Web.config outside of source control.