Team Foundation TFS 2010/2008 Deleting / Solving Multiple Workspace Problem

So you're setting up a new Workspace for Team Foundation and you get an error when you try and point a Source Control Project to a local folder that someone else was using as well..... Then you get the error message....

Error: "The working folder ... is already in use by another workspace on this computer"

I ran into this problem setting up a contractor's PC after the previous contractor using that PC had left.

The problem is you can't just go load up and delete workspaces unless your the owner. So in order to solve the problem I had to run a command line command for Team Foundation. Open Visual Studio 200x Command Prompt.

Tf workspace /delete developer05;<domain>\jsmith

 

To get that info I needed the owner name of the workspace and the workspace name. You can do

 

tf workspaces

  

You can find a list of Team Foundation (tf) commands here:

http://msdn2.microsoft.com/en-us/library/z51z7zy0(VS.80).aspx
You can see commands on that MS site, however the two most useful to me in this situation was listing the information, so I could see who was the other person blocking access, and then deleting it.

 

tf workspaces [/owner:ownername] [/computer:computername]
[/server:servername] [/format:(brief|detailed)]
 


tf workspace /delete [/server:servername] workspacename[;workspaceowner]

Note: Common mistake is to forget the domain name of the owner if you are on a domain. <domain>\UserName

 

Update:

So you’ve swtiched to a new machine or OS because your other system crashed and now you have these ghost items checked out in TFS and can’t check them in?

Easy.

First on TFS server, list the worksspaces for that old computer name (It tells you in Source Control Who and what PC has it checked out)

tf workspaces /server:http://…/Project/  /computer:mastro-pc

This will give you the list of workspaces:

 

Workspace                          Owner   Computer  Comment
---------------------------------- ------- --------- --------------------------

MASTRO-PC                          FMastro MASTRO-PC

SQL Source Control  (eb0jrdmq.4mh) FMastro MASTRO-PC Used by SQL Source Control

SQL Source Control  (ge1lsqh5.3gk) FMastro MASTRO-PC Used by SQL Source Control

SQL Source Control  (hewpvhe2.wai) FMastro MASTRO-PC Used by SQL Source Control

SQL Source Control  (vqdacg1f.bgr) FMastro MASTRO-PC Used by SQL Source Control

WIM 2010 (MASTRO-PC)               FMastro MASTRO-PC

 

Now go in and delete each one.

tf workspace /delete /sever:http://…/Project/ “MASTRO-PC”
tf workspace /delete /sever:http://…/Project/ “SQL Source Control  (eb0jrdmq.4mh)”

tf workspace /delete /sever:http://…/Project/ “WIM 2010 (MASTRO-PC)”

etc..

That will clear our those old changes you had on the no longer existent system.

Consolidate Excel Sheets to one Sheet using VBA

VB.Net Strip Numeric Characters from an Alpha-Numeric String