RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Programming Team Foundation Server with the TFS SDK

Team Foundation Server, Microsoft's offering for software lifecycle management, is both customizable and extensible through the TFS SDK.

hen working with Team Foundation Server (TFS), teams typically work on team projects, which are source-controlled collections of projects that let a manager track and assign individual tasks, called "work items."

You can find out a great deal more general information on TFS and team projects by reading the articles and visiting the sites listed in the Related Resources section (in the left column of this article). You should be somewhat familiar with TFS before you continue, so if you need the background information, read those first.

While the TFS UI supports most of the common tasks you might want to do with team projects, the TFS SDK lets you go "under the hood" to manipulate nearly any feature programmatically. This article explains how you can use .NET code (C# in this case) to access team projects programmatically, extracting work items and other details so you can use them in reports, as the basis for future projects, etc.

What You Need
To execute the code examples used in this article, you need to have Team Foundation Server, Visual Studio Team System 2008, and SQL Server 2005 installed.

Creating a New Team Project
In this section, you'll create a new project in Visual Studio, and then do the same in TFS Server. Here's a step-by-step list of the actions you need to follow:

In the Team Explorer window, right click and click on "New Team Project" to create a new team project (see Figure 1).

Figure 1. Create a New Team Project: Right-click on "New Team Project" in the Team Explorer window to create a new project.

You'll see the screen in Figure 2.

Figure 2. Name the Project: In the New Team Project dialog, specify a unique name for the new project.
Figure 3. Select a Process Template: Use the dropdown list to select the process template most appropriate for your project.

Type in a unique name for your new project and click "Next." The next screen that appears (see Figure 3) prompts you to select a process template.

A process template defines how a TFS manages a team project is managed. When creating a project, you select the process template most appropriate for your project, usually deciding based on the project's life cycle. As an example, Figure 3 shows the "MSF for Agile Software Development" process template selected from a dropdown list of templates. You can download additional process templates using the link visible in the dialog. After selecting a process template, click Next. You'll see the screen in Figure 4, which requests a name for the team project portal, and displays the portal site address.

Figure 4. Project Portal: Enter a name for the project portal and note the portal site address that appears near the bottom of the screen.
Figure 5. Source Control Settings: You can create an empty source folder, a new source control branch, or opt to create a source control folder later.

When you click Next, the wizard requests source control settings. Choose one of the three possible options shown in Figure 5.

Select the first radio button as shown in the screen shot above to create an empty source control folder, and then click Next. You'll see a confirmation screen (see Figure 6).

Figure 6. Project Confirmation: Review the settings you selected, and then click Finish.

Click the Finish button to complete the wizard and create the new team project. The Team Project Wizard displays a progress bar and lists the tasks as they're performed, such as creating the project itself, team groups, and assigning permissions (see Figure 7).

Figure 7. Creation Status: The wizard displays a status bar as it creates the new project.
Figure 8. Team Explorer with New Project: You'll see a number of items in the Team Explorer window for the new project.

The wizard displays a completion screen when the new team project has been successfully created. Click on Close to exit the wizard. At this point, your Team Explorer window should looks like Figure 8:

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date