Using the Source Control Explorer

The Source Control Explorer is similar to other explorers in Visual Studio. It enables you to browse and manage entire projects and individual folders in the repository. You can add and delete files; check in, check out, and view any of your pending changes; and view the status your local code compared to the code in Team Foundation version control. Think of it as your master control area for all tasks related to source code management. Some of the important tasks it will allow you to do include:

  • Creating Shelvesets. A shelveset is a collection of changes stored in a "shelf," or area, to temporarily store your source code without committing it to the repository.

  • Locking and unlocking files and folders.

  • Resolving conflicts.

  • Branching and Merging.

  • Viewing Historical Data.

  • Labeling your files and folders.

We will cover many of these topics later in the chapter. To access the Source Code Explorer, simply click View image from book Other Windows image from book Source Control Explorer.

Another way you can open your source code is by clicking File image from book Source Control image from book Open from Source Control. Visual Studio will then prompt you to connect to the Team Foundation Server and select the source code repository of your choice if you are not connected.

The Source Control Explorer interface is pictured in Figure 20-5. It is divided into three main areas: the source tree view on the left (which enables you to navigate and select source files from your project), the details view on the right, and the Source Location bar. The Workspace drop-down list enables you to easily jump from one workspace to another. You will examine workspaces in more detail in the next section.

image from book
Figure 20-5


When you create a project or solution, you can automatically add it to Source Control (as shown in Figure 20-6). Please note that a workspace is created only if you don't already have one. Think of the workspace as your local copy of the source files and folders contained on the server. It enables you to work on an application without affecting any changes the rest of your team might be making.

image from book
Figure 20-6

Each of the changes you make to these files will be pending until you check them in or undo them. Once they are checked into the repository, they will be committed into the main repository.

You can manipulate your workspace using the Team Foundation command-line tool. You can also manipulate it from the GUI by selecting File image from book Source Control image from book Workspaces. For example, to create a new workspace, simply type the following command:

     > tf.exe workspace /new MobileExplorerProject 

In the preceding example, a new workspace is created called MobileExplorerProject. Anyone can create his own workspaces, but you must be logged in as an administrator to create and assign workspaces for other people. Table 20-3 describes common workspace options.

Table 20-3

Workspace Options



Tag a workspace with a comment.


Specify the target computer for the workspace.


Delete a workspace.


Create a new workspace.


Rename an existing workspace.


Execute workspace commands without prompts.


Specify a workspace to be used as a template to create brand-new workspaces.

The workspaces (plural) command provides you with a holistic view of the workspaces on your Team Foundation Server. Note that the workspaces command will update the local cache file. It will cause the server to update its user cache when /updateUserName is used. The /updateComputerName option will change the computer name that is associated with the workspace on the server.

Table 20-4

Workspaces Options



Indicate what workspaces you want to view or manipulate from the repository, filtered by computer name.


Specify the format in which you would like to see the reports. You have two possible values at your disposal: Brief or Detailed. The default value is Brief.


Specify the creator of the workspace.


Specify the name of the Team Foundation Server.


Instruct Team Foundation Server to refresh because the client computer has changed name. It is typically written out as /updateComputerName:oldComputerName. The oldComputer-Name is the name that the computer had previously.


Instruct Team Foundation Server to refresh because one (or more) network users have changed names.

In addition to the command line, you can also use Visual Studio to manage your workspaces. Figure 20-7 shows the Manage Workspaces window. You can access this window by clicking File image from book Source Control image from book Workspaces.

image from book
Figure 20-7

Adding Projects to the Source Repository

Once you have created workspaces, you can import the associated source files into the repository. The process of putting code in Team Foundation Server is called checking in. (You'll learn more about the check-in/check-out process in the next section.) To open the Add to Source Control window, simply right-click your solution in the Solution Explorer and select Add Solution to Source Control.

First, select which Team Foundation Server project, workspace, and folders will end up in the repository. The combination of these elements makes up the solution. Click the Advanced button to invoke a window in which you can specify the project locations, as shown in Figure 20-8.

image from book
Figure 20-8

In the next section, you will learn how to effectively check in and check out code from the source repository. You also find out about changesets and how to configure team check-in policies.

Professional Visual Studio 2005 Team System
Professional Visual Studio 2005 Team System (Programmer to Programmer)
ISBN: 0764584367
EAN: 2147483647
Year: N/A
Pages: 220 © 2008-2017.
If you may any questions please contact us: