Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Team Foundation Power Tools Wrapper

0.00/5 (No votes)
7 Dec 2007 1  
Wrapper for common command line tools offered by Team Foundation Power Tools
Screenshot -

Introduction

This utility calls some of the very handy command line tools offered on Microsoft's website for accessing Team Foundation Server.

Background

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.

Power Tools

TfptWrapper itself is very straightforward. Following are the Power Tools I have wrapped in TfptWrapper:

  1. Review changes (tfpt review)
  2. Tree clean (tfpt treeclean)
  3. Undo unchanged items (tfpt uu)
  4. History (tfpt history)

Along with the Power Tools, I have also included the commonly used checkout and checkin commands from the command line tf.exe that comes with the Visual Studio Team Foundation installation.

  1. Bulk checkout (tf checkout)
  2. Bulk checkin (tf checkin)

The following command simply lists the files with certain wildcard input.

  1. 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.

  1. Open the Command.cs file and add the enum member to the Command enum that corresponds to the tool you are adding.
  2. Open TfptWrapperDialog.cs in design mode.
  3. Add a new tab page to the Tab control. Name it appropriately.
  4. In the tag property of the tab page, enter the enum member name exactly as it is in Command enum.
  5. Add the controls for collecting the parameters for the command.
  6. Open the source code for TfptWrapperDialog.
  7. In the ExecuteCommand method and add a case statement using the enum member in Command enum.
  8. Open TfptWrapperController.cs and add method InvokeXYZ, where XYZ is your command.
  9. Add appropriate source code.
  10. Call this method in the ExecuteCommand method of TfptWrapperDialog.cs in the case statement for your command.
  11. Test it.

Points to Remember

The 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.

Special Note

Thanks to Andrew Tweddle for providing the CommandLineHelper class.

History

  • 7 December, 2007 -- This is the first version 1.0.0.0

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here