TFS2010: Public Workspaces

Grant Holliday’s blog

Senior Service Engineer, Microsoft Visual Studio Team Foundation Service

TFS2010: Public Workspaces

Rate This
  • Comments 6

Public Workspaces is a feature that we built last year mainly for our internal build lab customers. Before TFS2010, if one user tries to use a workspace that belongs to another user on the same machine, they will receive an error message:

No workspace matching *;SecondUser on computer COMPUTER found in Team Foundation Server http://tfsserver:8080.

The Public Workspaces feature removes this limitation of one user per workspace and allows multiple users to use the same workspace mappings on a single machine. Unlocked workspaces are sometimes also referred to as "Shared workspaces", as they can be shared among multiple people.

Additionally, we enabled the ability to change the owner of a workspace, if you don’t want to share a workspace at all, but just reassign it to a different user.

Scenarios

Shared Machines

"I need to setup a shared ProductX enlistment machine; we’d like to use it to run tests, integrations and such."

"Our team has a rotating branch-owner role, so we have no choice but to use a service account."

"We find it very useful to have a shared machine that anyone on our team can use to investigate issues, checkin fixes, etc."

"Is there a way to make a TF enlistment user-neutral, so that anyone who logs into the build machine can open the enlistment, and use TF commands – and those commands will be run as the username of the loggedin user?"

Save disk space

"We need to use it to save disk space on shared machines."

Split personalities

"I have two admin accounts on the box. I use one of them to enlist in the branch and work with TFS. The problem is when I use another one (labaccount vs. personal account) I can login, but I cannot run any tf command because enlistment belongs to the first user only."

Hotdesking

"I'm taking over another dev's machine for a week while he works on another project and he has all the development tools already setup"

Workarounds for TFS2008

Before this feature existed, there were are few different workarounds that people were using:

Workaround

Description

Shelvesets

The various developers pass shelvesets around

Run As

The owner starts a cmd shell / VS window with RunAs

Shared User Account

Create the workspace using a shared system account, then have all developers use that account on that machine.

This has the downside that all changes are checked in as the shared account, rather than the actual user.

You can overcome this by using the "/author" flag with the actual username, but only if the shared account has the CheckinOther permission.

SUBST path substitution

Use the windows SUBST.EXE "Substitution" utility to map a different drive letter to the same physical path. This tricks TFS into thinking that the workspace doesn't exist.

Usage

The owner of the workspace should run the "tf workspace" command and select a workspace permission profile from the drop-down box. The default is "private."

image

  • A Private workspaces works the same as a workspace in TFS2008.
  • A Public (limited) workspace can be used by any valid user. Only the owner can check in or administer the workspace
  • A Public workspace can be used by any valid user. Anybody can check in or administer the workspace as long as they have permissions to the underlying files. The checkins will still be attributed to the person checking them in.

Workspace permissions profiles

 

Private

Public-limited

Public

Read

Everyone

Everyone

Everyone

Use (most operations -- such as pend changes, resolve, etc.)

Owner only

Everyone

Everyone

Check in

Owner only

Owner only

Everyone

Administer (change owner, mappings, etc)

Owner only

Owner only

Everyone

Once a workspace has been made public or public-limited, another user can log onto the machine with the workspace and use the workspace. The other user will need to refresh their local workspace cache manually by using the "tf workspaces /collection:http://server:8080/tfs/collection" command before they will be able to use the workspace (otherwise they will not know the workspace is there -- because they did not create the workspace, and the local workspace cache is per-user).

  • Perfect entry, had a very similar problem at my workplace and they are still trying to work it out, lol :)

    Good to see another Aussie showing em how it's done!

  • I create a public workspace, When another user selects my public workspace and does a "Check out file for Edit", the file is checked out to me. I was hoping to see the file was checked out to the other user. Why is this occurring?

  • @Dave - Pending changes don't have an explicit owner associated with them - the owner comes from the owner of the workspace.

  • I thought you might say it was the owner of the workspace, but this makes it difficult to keep track of who is doing what. I would look at this checked out file and say, "why did I check it out?". For the person who checked it out, they have to remember they checked it out. When you work in a product support environment and you want to make a change to the same file and some else has the file checked out, it is nice to know who really has the file checked out, so that I can ask them how much longer or when will they be finished with their changes. By not showing the correct user who checked out the file, this makes the process more complicated than it needs to be.  Is there any chance this could be changed to show the correct person who checked out the file?

  • Thanks for sharing this!

    I realize you wrote this quite a while ago but I guess that it is still reflecting the current public workspace function in VS2010.

    With this function we are almost there when it comes to cope with the scenarious you mention. The bad thing, which make public workspace impossible to use in our case, is that when you take over a public workspace, and if you forget to

    actively go in and change owner the actions you perform will be in the name and with the privileges of the 'previous' owner.

    Would it be possible to automatically change owner when you open VS2010 and give your credentials for TFS login. That way detecting that the new login does not represent the current owner of the active public workspace.

  • I have this asp.net website project that 2 people work on from different computers. I would like to know how to set up a workspace where both the computers can access the same source code. Please help.

Page 1 of 1 (6 items)