TFS – deleting old workspaces

I use Visual Studio 2008 on a daily basis however for some older projects I have to work with VS 2005. Recently our company has set a new Team Foundation Server in use and all active projects have been migrated there. In VS 2008 everything worked just fine.

However when trying to re-map a project to the same localtion as before (only from the new TFS server) I got the following error message: “The path [yourpath] is already mapped in workspace [yourworkspace]”. It took me a while to figure out what the resolution of the problem was.

Attempts not working

It was obvios that a conflict occured with the previos workspace. However I had no access to the previos TFS server and could not view or delete the previos workspace. (When having access to the existing TFS server the workspace uses it is easy to delete it either with the Team Foundation Sidekick – get latest version here).

When not being able to connect to the TFS server workspaces associated to that server cannot be accessed with the GUI (or at least I found no way) and cannot be deleted. However this can be done with command line. I borrowed the idea from a post by Mahesh Mitkari and first checked if the workspace is indeed mapped. To list the workspaces mapped in the system use this command:

tf workspaces

(Note that tf.exe is either located within C:\Program Files\Microsoft Visual Studio 8\Common7\IDE for VS2005 or C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE for VS2008).

To delete a workspace simply type

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

After typing this command I got the error “Unable to connect to the remote server. Command cancelled”. Something was definitely not right: why can’t I delete any workspace without connecting to it?

The solution

It turned out that I was on the wrong track all the time. After searching I ran into the solution by Buck Hodges in a comment on a blog. Turned out that getting rid of disconnected workspaces isn’t done by deleting but by removing them with the following command:

tf workspaces /remove:*

This command cleans out all cached workspaces. And this was the thing that solved my problem. (Actually it didn’t make that much sense why there are these two distinct commands… here’s a good blog post on this topic)

8 Responses to TFS – deleting old workspaces
  1. Bob MacNeal

    Nice discovery. I pulled my hair out a few months ago with this problem. I too, had tried delete instead of remove…wish I had known then. I finally threw my hands up, and opened a ticket with a TFS admin. Two days later my workspace was gone. Whew.

  2. [...] I usually work using Team Foundation Systems over VPN. And sometimes my VPN access is revoked because I ...
  3. @jeffreywatson

    Great post! I ran into the exact same thing and the /remove did the trick. thanks!

  4. Chris Tesene

    Thanks a million.. I posted a link from my site to yours!

  5. online forex account... [...]Greg Does IT » Blog Archive » TFS – deleting ...
  6. it problemerordnes her... [...]Greg Does IT » Blog Archive » TFS – deletin...
  7. ClientMesh is a remote administration application designed to allow you to administrate multiple machi...