11

I have had a nagging feeling for some time that I may be ignoring useful qualities of TFS Workspaces. The site here provides some great background on what they are: http://www.woodwardweb.com/teamprise/000333.html.

However, given this information, I don't really understand when I ought to create a new workspace. Do I create one for each "project"? Do I create one for each project-branch? Do I need to create mirror workspaces on every machine that I intend to work on? I'm not sure what I need to consider when making this decision.

Is there a best practice describing under what circumstances to use different workspaces?

Note: although it may be interesting to learn what practice others follow, I am more interested in learning about how to make the decision myself. I'm not really asking "When do you create new workspaces?". Instead, I am asking "How do I decide when to create a new workspace?".

1
  • I don't have a TFS 2010 system handy at the moment, but certainly under 2008, I got annoyed that certain changes would automatically be selected when performing a check in, no matter where the check in appeared to be scoped. The solution was separate workspaces Jul 20, 2011 at 17:30

2 Answers 2

13

A workspace is defined per machine, per team project collection (TPC), therefore you need at least one workspace per machine you are working on, for each TPC you use.

Having a snapshot of the entire TPC on your machine might be both wasteful (you might not need access to projects or solutions that are maintained by other teams or developers, so you might want to create a workspace per team project or even one workspace per solution.

If you find yourself working on more than one task at the same time, you might want to create one workspace per task. This is considered a best-practice, and will allow you to separate the changes you make and check them in one task at a time (e.g. one workspace for a development task such as build a new UI, and another for fixing a bug recently found by QA).

Workspace per task works particularly well if your task vertically crosses multiple solutions (e.g. adding a UI, business logic, SOA service and updating the schema on a remote database, all as part of adding a new feature to your product); A task will rarely (if ever) cross team projects and should never cross TPCs.

1
  • 1
    If a Team Project is usually a solution or collection of solutions for a single client or platform, then creating a workspace per Team Project will at least de-clutter your Team Explorer / check-in view. Otherwise, TFS is eager to do confusing things—like showing you differences from projects and solutions unrelated to the currently open one.
    – Paul Smith
    Feb 26, 2014 at 19:45
4

Short answer, when you need to :-)

If you need to edit code on multiple machines then you will be forced to create a workspace on each machine.

Some people like to have a workspace per Team Project, others per branch or even solution.

Are you working on the same codebase but for different reasons? Branching is usually used to solve this but sometimes it's not an option.

Are the folder / file names in your repository causing you to hit the windows 260 character limit in a path? If so, time for a new workspace.

I tend to have 1 work space per machine mapping $/ to C:\tfs but that's my preference. The only time I create a new workspace is when I need to limit the number of files in scope.

For example, rolling back a changeset. If you use the tf rollback command (or tfpt rollback in 2008) then tfs insists on performng a get latest on the entire workspace. If you've got your workspace mapped to the root of a big team project this can take a long time. Setting up a workspace that only includes the folders that contain the files in the changeset can be a real time saver

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.