Friday, June 20, 2008

How to delete workspace from TFS (Team Foundation Server)?

Now its long time I’m working on TFS, everyday leaning something new as it’s creates new problem for me. (It’s really a sweet product, but only if you are good in command prompts use and expert to use TFS)

Yesterday due to some locking and conflict issues I need to delete a workspace on one machine. Initially I was searching Visual studio for any option to delete it something like Right click delete optionJ, unfortunately there is no option like this; I don’t understand why Microsoft is not providing nice GUI interface for TFS management just like other Microsoft servers. Command prompt is only way to do any TFS management related operations.

Ok so next problem is- the command to delete or unlock the workspace?
Some MSDN and Google search solves the problem. Here are the TFS commands which you can use on “Visual studio Command prompt”

List the Workspace names, owners etc

  • tf workspaces /server: ServerName /owner:*
  • tf workspaces /server: ServerName /owner: OwnerName

Delete the workspace

  • tf workspace /server: ServerName /delete WorkspaceName

Remember after deleting workspace you can not recover it…
you can find more workspace related commands at

http://msdn.microsoft.com/en-us/library/54dkh0y3(VS.80).aspx

4 comments:

Gergely Orosz said...

I ran into the same issue as well and it was the command promt that saved me as well. There's another important command which only removes cached workspaces (this is useful when connection cannot be made to the TFS server and so * tf workspace /server: ServerName /delete WorkspaceName won't work):
tf workspaces /remove:*

Shane Larson said...

Thanks for this post. It was very helpful when I was trying to delete an old duplicated workspace. Great instructions!

AmiT said...

Thanks a lot.

Vivek said...

I have a 5 project mapped on my machine. The folder size is so large that I want to unmapped few unused project to spare some space on my local drive. Do you know how can I unmapped folder in TFS, so that I can recover hard-drive space back.