Here’s a neat visual studio tip. You can run any external command from within visual studio, and add a button to the command bar or map it to a keyboard shortcut. This is really important to me because I rely heavily on keyboard shortcuts. I love that I can hit a combination of keys and perform a repetitive task automatically, plus the result can be incorporated into visual studio by way of the output window.
Some examples of what you might use this for:
- Get latest on several team projects to start your day.
- Check out a specific set of files.
- Automate various git commands from within visual studio.
- Run a batch file with a set of arguments that you define when you run it.
- Launch another application (i.e.: web browser).
What follows is inspired by Rob Conery’s Git series on tekpub. You’ll have to watch the full video to see how he uses external tools to incorporate git in Visual Studio.
To get started from the menu go to Tools -> External Tools.
Then you should see a dialog that looks like this:
Some of the options are pretty self-explanatory.
- Title is obvious.
- Command is the path to the command to execute, also obvious.
- Arguments is pretty simple on the surface, but we have some interesting options at our disposal, which you can use to make the command contextual.
- We have similar options for the initial directory.
So, now that you have your external command, you can run it from the “Tools” menu.
You can also add buttons to the toolbar, map keyboard shortcuts (search for “ExternalCommand1, “ExternalCommand2”, etc.), and maybe even add context menu items (though I haven’t figured that one out completely).