pnp.gif

How To: Step Through Creating Your Source Tree in Team Foundation Server 2005

J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

Applies To

  • Team Foundation Server 2005

Summary

This How To steps you through the process of creating a new source code tree structure in Team Foundation Server. The purpose of this how to is to familiarize you with the end-to-end steps required to create your source tree..

Contents

  • Objectives
  • Overview
  • Summary of Steps
  • Step 1. Create a new team project.
  • Step 2. Create a workspace mapping
  • Step 3. Create your folder structure in Source Control
  • Step 4. Add your source to your source tree
  • Additional Resources

Objectives

  • Learn how to create your source tree in Team Foundation Server.

Overview

While you can quickly add a solution to source control by right-clicking your solution in Solution Explorer and clicking Add Solution To Source Control, this option does not enable you to explicitly set up your source tree structure in source control. By explicitly defining your source tree structure in source control, you can arrange your source beneath top level folders and use separate top level folders to contain your main source base and your branched source base such as the branches you might use during development or to maintain production releases.

In this how to you will see the steps required to explicitly create a source control tree structure.

Summary of Steps

  • Step 1. Create a new team project
  • Step 2. Create a workspace mapping
  • Step 3. Create your folder structure in Source Control
  • Step 4. Add your source code to your source tree

Step 1. Create a New Team Project

In this step you create a new team project with default settings.

To create a new team project:
  1. In Team Explorer, right-click your Team Foundation Server and click New Team Project…
  2. In the New Team Project dialog box, type a project name such as MyTeamProject1 and click Next.
  3. On the Select a Process Template page, leave the default MSF for Agile Software Development - v4.0 and click Next.
  4. On the Specify the Settings for the Project Portal page, leave the team project portal name as MyTeamProject1 enter a description for the team project portal and then click Next.
  5. On the Specify Source Control Settings page, leave the default option Create an empty source control folder selected and then click Next.
  6. Click Finish to create the project.

A new team project is created on your team foundation server, using the selected process template with an empty source control node.

Step 2. Create a Workspace Mapping

In this step you create a workspace mapping to define the mapping between folder structure on the TFS server and client. You need to do this so that you can create a source tree structure. First the source tree structure is created in your workspace and then you need to perform a check-in to your Team Foundation Server.

You can create a workspace mapping in one of two ways:
  • Set the workspace mapping explicitly
  • Perform a get operation on your team project.

To set a workspace mapping explicitly
  1. In Visual Studio from the File menu, point to Source Control and then click Workspaces.
  2. In the Manage Workspaces dialog box, select your computer name and click Edit.
  3. In the Edit Workspace dialog box, in the Working folders list, click Click here to enter a new working folder.
  4. Click the ellipsis button, select your team project for example MyTeamProject1, and click OK.
  5. Click the local folder cell to display another ellipsis button.
  6. Click the ellipsis button beneath Local Folder and browse to and select the local folder on your development computer where you want to locate your team project, for example C:\DevProjects\MyTeamProject1.
  7. Click OK and then OK again to close the Edit Workspace dialog box.
  8. Click OK in response to the Microsoft Visual Studio message box that informs you than one or more working folders have changed.
  9. Click Close to close the Manage Workspaces dialog box.

To perform a Get operation on your team project
  1. In Team Explorer, expand your team project node MyTeamProject1.
  2. Double click Source Control beneath your team project.
  3. In Source Control Explorer, right-click the root folder MyTeamProject1 and click Get Latest Version.
  4. In the Browse For Folder dialog box select your local path, for example C:\DevProjects\MyTeamProject1 and then click OK. This maps the team project root folder within Team Foundation Server to a local path on your computer.

Step 3. Create Your Folder Structure in Source Control

In this step depending upon your strategy and project requirements you create a source control folder structure on your server. This should generally start with a /Main/Source folder structure. This enables you to subsequently create Development and Maintenance branches at the same level as Main. For example, the Maintenance folder would be used to contain branched code corresponding to your software releases. The Development folder contains your working development branch.

/Main 							
	/Source
		/MyApp1				 Contains MyApp1.sln
			/Source			 Container folder 
				/ClassLibrary1		 Contains ClassLibrary1.csproj
				/MyApp1Web		 Contains Default.aspx
			/UnitTests			 Contains unit test projects
				/ClassLibrary1Tests	 Test project for ClassLibrary1
				/MyApp1WebTests	 Test project for MyApp1Web
/Build						 Contains build output (binaries)
	/Docs						 Contains design docs etc
	/Scripts					 Contains build scripts
	/TestCases					 Contains test case documentation

/Development
	/FeatureBranch1
		/Source
			/MyApp1
				/Source	
					/MyApp1Web
					/ClassLibrary1
				/UnitTests
					/ClassLibrary1Tests	
					/MyApp1WebTests	
	/FeatureBranch2

/Maintenance
/Release1
			/MyApp1
				/Source
					/ClassLibrary1
					/MyApp1Web
				/UnitTests
					/ClassLibrary1Tests
					/MyApp1WebTests
/Release 1.1
/Release 1.2


To create a folder structure on the server:
  1. In Team Explorer, expand your team project node MyTeamProject1.
  2. Double click Source Control beneath your team project.
  3. In Source Control Explorer, select the root node, right-click in the Local Path: pane and click New Folder.
  4. Type the name Main and then press ENTER.
  5. Create a Source folder beneath Main.
  6. Repeat the previous steps to create any other root folders you might need including Development and Maintenance folders.
  7. Once you have created your tree structure, right click the MyTeamProject1 root node in Source Control Explorer and click Check-in Pending Changes.
  8. In the Check In - Source Files – Workspace dialog box, select the folders you need to check-in, add a comment and click Check In. This builds your local folder structure and adds the structure to TFS source control.

Step 4. Add Your Source Code to Your Source Tree

In this step, you add source code from your local drive to your source control tree on the server. In this example, you create a new Web application and class library project and add these to source control.

To create a new Visual Studio solution file:
  1. From the File menu, point to New, and click Project.
  2. Expand Other Project Types and click Visual Studio Solutions.
  3. Select Blank Solution in the Templates pane.
  4. Type MyApp1 into the Name text box and C:\DevProjects\MyTeamProject1\Main\Source into the Location text box.
  5. Click OK. Visual Studio creates your new solution and places the solution (.sln) file in the C:\DevProjects\ MyTeamProject1\Main\Source\MyApp1 folder.

To add a new Web site to your solution:
  1. Right-click your solution in Solution Explorer, point to Add, and click New Web Site.
  2. Select ASP.NET Web Site from the Templates list, File System as the Location and C:\DevProjects\MyTeamProject1\Main\Source\MyApp1\Source\MyApp1Web as the path.
  3. Click OK. Visual Studio creates the Web site.

To add a new class library project to your solution:
  1. Right-click your solution in Solution Explorer, point to Add, and click New Project.
  2. Select Visual C# from the Project types list, and Class Library from the Templates list.
  3. Leave the name as ClassLibrary1 and set the Location to C:\DevProjects\MyTeamProject1\Main\Source\MyApp1\Source.
  4. Click OK. Visual Studio creates the new project structure. Your local file structure should now look like this:


To add your solution to source control:
  1. Right-click your solution in Solution Explorer and click Add Solution To Source Control.
  2. Your solution, and two projects are added to Team Foundation Source Control.

Your source control tree structure should look like the following:
How To - Step Through Creating Your Source Tree in Team Foundation Server 2005 - Figure 1.gif

Additional Resources

For more information about structuring your projects in Team Foundation Source Control, see “How To: Structure Your Source Control Folders in Team Foundation Server”

Last edited Mar 22, 2007 at 1:08 AM by mycodeplexuser, version 6

Comments

No comments yet.