Default Working Folders in TFS

Last week a customer moving from PVCS to Team Foundation Server Version Control asked me how they could specify a default working folder for a solution within his team project.  With PVCS they set working folders to default to a mapped Z:\ drive so that they know their code will build on any developers machine.

TFS uses Workspaces which are unique to each user.  In each workspace you'll need to specify a local folder loacation to store the code on your dev machine. 

When you create a new workspace all mappings are blank so to achieve something similar with TFS you could create a initial workspace that maps the solution to the Z:\ drive on a developers machine. 

Subsequent developers can then clone that workspace which will set the mappings exactly the same on their own machines (note that it won't work if yiou are both using the same machine as the location will already be mapped to an existing workspace.

You can do this from the command line using tf.exe

tf workspace /new <NameOfNewWorkspace> /template:<WorkspaceToClone>;<UsernameOfTemplateWorkspaceOwner> /server:<server>

So for example if I wanted to clone "Darren's" workspace called "MainDev" on server "TFSRTM" I could use

tf workspace /new MyNewWorkspace /template:MainDev;Darren /server:TFSRTM 

Check out the docs on the Workspace Command here:
https://msdn2.microsoft.com/en-us/library/y901w7se(VS.80).aspx