This utility calls some of the very handy command line tools offered on Microsoft's website for accessing Team Foundation Server.
Currently, I am maintaining three different projects in TFS. I use the Team Foundation Server Power Tools provided on Microsoft's website. Since I use them often, I thought of creating a UI for the most commonly used tools. I needed something that would capture the command line output so that when a command is executed, the command line output is captured and returned to the UI. I searched on The Code Project for such a utility for .NET and I found the CommandLineHelper class to launch console applications and capture their output by Andrew Tweddle. Thanks to Andrew for this utility.
TfptWrapper itself is very straightforward. Following are the Power Tools I have wrapped in
- Review changes (
- Tree clean (
- Undo unchanged items (
- History (
Along with the Power Tools, I have also included the commonly used
checkin commands from the command line
tf.exe that comes with the Visual Studio Team Foundation installation.
- Bulk checkout (
- Bulk checkin (
The following command simply lists the files with certain wildcard input.
- Search (
dir /s/b *.*)
When any of these commands is executed using the Execute button, a batch file is created that is then passed into the
CommandLineHelper class with the required parameters and executed in a asynchronous process. The
CommandLineHelper class returns the output of the batch file. This output is directed to the Output text box.
Workspace History Feature
Since I have to work in three different projects, there are three workspaces that I need to work in. So, I have provided the History button right beside the Workspace location that keeps track of the workspaces I visit. So, next time, I don't have to navigate to those folders. I simply click on the History button to open a dialog and select the one I want.
Adding New Tools
If you need to add more tools to this utility, following are the steps that need to be taken.
- Open the Command.cs file and add the enum member to the
Command enum that corresponds to the tool you are adding.
- Open TfptWrapperDialog.cs in design mode.
- Add a new tab page to the Tab control. Name it appropriately.
- In the
tag property of the tab page, enter the enum member name exactly as it is in
- Add the controls for collecting the parameters for the command.
- Open the source code for
- In the
ExecuteCommand method and add a
case statement using the enum member in
- Open TfptWrapperController.cs and add method
XYZ is your command.
- Add appropriate source code.
- Call this method in the
ExecuteCommand method of TfptWrapperDialog.cs in the
case statement for your command.
- Test it.
Points to Remember
Abort functionality does not actually abort the currently running command. It simply returns back to the main application without collecting the output from the
CommandLineHelper class. I still have not figured out how to abort a command run through the
CommandLineHelper class. If you know, please let me know so that I can incorporate it in this utility.
Thanks to Andrew Tweddle for providing the
- 7 December, 2007 -- This is the first version 22.214.171.124