How to remove a TFS Workspace Mapping?

I had a project in tfs within a team project then we moved the project to a different location in another team project.

I had configured Jenkins to connect to the team project and build my solution but when I changed the settings to connect to the new tfs team project, it gives me the below error:

[workspace] $ "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe" workspace -new Hudson-ProjectName1-Build-MASTER;domain1\username1 -noprompt -server:http://domain-eg.net:8080/tfs/newteamproject ********
The path D:\jenkins\jobs\ProjectName1-Build\workspace is already mapped in workspace Hudson-ProjectName1-Build-MASTER [http://domain-eg.net:8080/tfs/oldteamproject].

So the above shows that there is an existing workspace so I ran the below command to remove it

tf workspace -delete Hudson-ProjectName1-Build-MASTER;domain1\username1 -noprompt -server:http://domain-eg.net:8080/tfs/oldteamproject

and it prompted that the workspace has been removed but I'm still getting the same error.

I also checked whether the mapping has been removed or not by running the below command:

tf workspace -server:http://domain-eg.net:8080/tfs/oldteamproject Hudson-ProjectName1-Build-MASTER

but it says the workspace doesn't exist as expected.

So, I thought it might be caching it somewhere and ran the below command:

tf workspaces /remove:* /collection:http://domain-eg.net:8080/tfs/oldteamproject

and it said "No workspace in the cache matches * from server http://domain-eg.net:8080/tfs/oldteamproject"

so I'd guess it's not even cached.

So what's causing the error and how to resolve it?


From VS:

  1. Open Team Explorer
  2. Click Source Control Explorer
  3. In the nav bar of the tool window there is a drop down labeled "Workspaces".
  4. Extend it and click on the "Workspaces..." option (yeah, a bit un-intuitive)
  5. The "Manage Workspaces" window comes up. Click edit and you can add / remove / edit your workspace

source control explorer

From VS on a different machine

You don't need VS to be on the same machine as the enlistment as you can edit remote enlistments! In the dialog that comes up when you press the "Workspaces..." item there is a check box stating "Show Remote Workspaces" - just tick that and you'll get a list of all your enlistments:

show remote workspaces

From the command line

Call "tf workspace" from a developer command prompt. It will bring up the "Manage Workspaces" directly!


I ran into the same problem, and was able to fix it by manually deleting all the files in the TFS cache, located here:

%LocalAppData%\Microsoft\Team Foundation\3.0\Cache

or 4.0, 5.0, etc.


Follow these steps to remove mapping from TFS:

  1. Open team explorer
  2. Click Source Control
  3. Right click on you project
  4. Click on Remove Mapping

The error is genuine. You might have created workspace with same name on different machine. Now you may have changed machine having different machine name.

So here is work-around that will definitely work.Following is work-around.

  1. Go to "Team-Explorer"
  2. Go to "Source-Control"
  3. Go to Workspace drop-down
  4. Click on "Workspaces..."
  5. A pop-up window will appear
  6. Click on "Show remote workspaces"
  7. Now delete the workspace which is conflicting and you can proceed your work.