Console2 Integration With Visual Studio 2012

Do you need any kind of command line access for your Visual Studio projects? If so, that built in CMD in Windows works… but it could be a lot better.  In comes Console2 – all hail the power!  Go ahead and download it on SourceForge, although it hasn’t been updated since 2010.  If you’re new to Console2, I highly recommend first using Scott Hanselman’s recommended default setup for it. It looks much better and makes more sense after you do this.

Setting Up Console2

image001At work, we have several command line utilities that we need to run occasionally. Sometimes it’s a cleanup script, sometimes it starts a listening service for other projects we need to run.  After a while it got to be a real pain to always have to manually type in the commands and memorize the long file paths.  We soon found out that Console2 has support for custom tabs!

Here’s a screenshot of how this can look in the end.

 

image002To add these custom tabs, open the Console2 settings, and go to “Tabs”.  Add a new tab for each .bat script you want to run. Now, you just have to fill in two fields minimum like this:

Shell: %comspec% /k C:\path\to\your\folder\FILE.bat
Startup dir: C:\path\to\your\folder\

You can also do some other cool stuff like color code the backgound of each custom tab! That’s it, Console2 now has some helpful customized tabs.

Setting Up Visual Studio

image003Now in Visual Studio, you can add a button to launch Console2 to the current solution directory, sounds good right?

Go to the Tools > External Tools menu and add an entry for Console2. Point the Command to the executable for Console2, and make sure that Initial Directory is set to $(SolutionDir).. to ensure that Visual Studio passes the argument to Console2 for it to initially start in the current solution directory.

Remember the order in which this entry appears! We will need to use this number later. In this case, let’s save it as the first tool, so it’s #1 in the list.

 

image004Now the tool exists, we just have to add a button for it.  Find a toolbar you want to add the button to, click the flyout menu and and select customize…

 

image005In the next window, press Add Command and then select the Tools category.  Depending on the order of the external tool we made earlier, select that external tool.  In this case it was the first item in the external tools list, so I will select the first external command.

 

image006Now it will appear in your toolbar as “External Tool 1” which you will probably want to rename to something that makes more sense.

Now when you click your newly added button, Console2 will be launched and it will automatically start at your current solution directory! Pretty handy.

One reply

  1. Terry Aney says:

    I have the exact same settings as you in the External Tools dialog, but when I click that menu item, it doesn’t open to the Solution directory instead it opens my first ‘predefined tab’ in Console2 Preferences. Any idea?

Leave a Reply