Wednesday, September 24, 2008

Checking in Files / Removing Locks in TFS

I've found this to be an issue on multiple occasions. Essentially you're using Team Foundation Server with Visual Studio and a member of your team leaves with code checked out or locked.

There are a couple of ways to fix this but the easiest I've found is with TF.exe. If you have Visual Studio installed and priviledges you can use this tool to fix you problem.

Note: You can find the TF.exe tool in:

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\TF.exe (VS2005)


C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe (VS2008)

Get a list of workspaces for a user:

tf workspaces /owner:UserName /server:ServerName

eg. if my user name was JDoe and my TFS web server name MyTFS then the command would be:

tf workspaces /owner:JDoe /server:MyTFS

Note: Use the Host Name of the server you're attaching to. If you have a multiple server configuration, you need to use the Server Name of the web server where your TFS client connects to. Don't use the host header (if applicable) or the http address and you don't need to use the Fully Qualified Domain Name (FQDN).

To remove a workspace for a user, you need to know the workspace and the username. The default workspace name is their development machine name. Occassionally developers have multiple machines, maybe a laptop and a desktop for development. It's not uncommon to have multiple workspaces associated to the same usere.

Delete a workspace for user:

tf workspace /delete /server:ServerName "workspace";"workspaceusername"

eg. if my username was JDoe and my workspace was JDoe2003, and my TFS web server was MyTFS, the command would be:

tf workspace /delete server:MyTFS JDoe2003;JDoe

Get a list of directories in a workspace for a user and display the GUI (Graphical User Interface):

tf workspace "workspacename";"workspaceusername" /server:ServerName

eg. if my user name was JDoe and my TFS web server name MyTFS then the command would be:

tf workspace JDoe2003;JDoe /server:MyTFS

1 comment:

Anonymous said...

Thank you so much for your help!!