Freigeben über


Cloaking in TFS

In the past couple of days, I've been delving into prescriptive architecture guidance for Team Foundation Server (TFS). Along the way I learnt something new, something I never knew existed in TFS. It's called cloaking. Allow me to quote the following text from the Team Development with Visual Studio Team Foundation Server prescriptive architecture guidance (search under Chapter 4):

Cloaking

You can use cloaking as a performance optimization when you want to prevent a part of the source control tree from being retrieved. The following are typical scenarios for using cloaking:
• You want to build the project locally and a folder is not needed for the build, for example a documentation folder.
• You are part of a large team project and you only want to retrieve part of the project.

For either of the above scenarios you can cloak folders to stop the client retrieving those folders. You cloak folders on the client by editing the workspace and changing the status of the working folder from active to cloak.

Keep the following recommendations in mind when you cloak:
• Do not cloak individual files. This is likely lead to maintenance problems later in the project.
• For a large project, map out the root folder and cloak sub folders rather than creating multiple workspaces for the project.

Having said that, I went ahead to put this to practice on Visual Studio TFS 2008. Before I got started, I paid close attention to the statement that says, "You cloak folders on the client by editing the workspace and changing the status of the working folder from active to cloak." .

The question that begs is "What is a Workspace?" .

 

Workspaces Explained
A TFS workspace is a client-side copy of the files and folders in TFS source control. A workspace maps source control folders to local file system directories. When you make changes to files within the workspace on your local computer, the local changes, referred to as pending changes, are isolated in your workspace until you check them into the server as an atomic unit. The collective set of changes, checked in as a batch is referred to as a changeset.

 

As a good measure for practice, I didn't want to edit my existing default workspace, so I created a new workspace. This new workspace will map the source control folders to a new folder in my local file system. These were the steps I took to create a new workspace:

  1. Create a new workspace.
  2. In your Source Control Explorer, go to the Workspacescombo box. Click Workspaces... (as shown in the following diagram)image
  3. This brings out Manage Workspaces window. image
  4. Click Add.
  5. Then, I mapped the solution folder in my source control to a local folder as shown below. image
  6. Since the Doc folder is not required in the building of my solution, I want this folder cloaked. Another reason why I would want the documents folder cloaked is because there may potentially be very large files that I do not want to update from the source control every time I get latest changes.
  7. After I've cloaked the Doc folder, when I get latest version from the source control, it will not get the files under the Doc folder, and the folder appears as grey in the Source Control Explorer.
  8. Done!

Please bear in mind that you can only cloak folders that have a mapped parent. Otherwise you get an error message like the following.

image

Comments

  • Anonymous
    October 01, 2008
    PingBack from http://www.easycoded.com/cloaking-in-tfs/

  • Anonymous
    October 08, 2008
    Charles Sterling on 9 sessions at PDC on Visual Studio Team System 2010 Brian Harry on Combining Team...