6

I am trying to understand how to solve the following situation.

I have a TFS 2012 server with three collections, say;

- http://tfs2012:8080/tfs/DefaultCollection/
- http://tfs2012:8080/tfs/CollectionOne/
- http://tfs2012:8080/tfs/CollectionTwo/

In CollectionOne and CollectionTwo I have a workspace of the same name, lets call it "TestWorkspace".

When I run a map command for that workspace on CollectionOne it works perfectly (can get, delete, update, etc). The issue comes when I try to unmap the workspace as I am done using it (think build machine), the following call fails.

tf.exe workfold /unmap /workspace:TestWorkspace E:\Temp

It fails with;

Multiple workspaces exist with the name TestWorkspace.
Please specify the Team Foundation Server or qualify the name with the owner.

Therefore I try the following;

tf.exe workfold /unmap /workspace:TestWorkspace E:\Temp /collection:http://tfs2012:8080/tfs/CollectionOne/

Which fails with the following;

The option collection is not allowed. 

Also specifying the owner of the workpsace doesn't help as they are owned by the same user.

How do I unmap a workspace which exists in two or more collections?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Jason
  • 840
  • 11
  • 23

2 Answers2

3

This has been reported as a bug here: https://connect.microsoft.com/VisualStudio/feedback/details/574162/tf-workfold-unmap-not-accepting-collection-option

See here for a workaround: http://wiert.me/2012/08/29/vs2010-workfold-command-allows-moving-a-local-working-folder-for-a-workspace-but-not-unmapping-it-when-you-have-multiple-workspaces-with-the-same-name/

sparkplug
  • 1,317
  • 2
  • 15
  • 32
  • Marking this as the answer as it seems this is an error with TF.exe and workfold. The way to fix the problem is to either delete the workspace using the collection specification, or to remap all the workspaces to another location. – Jason Aug 21 '13 at 01:31
1

This is indeed an annoying defect. Here's a simple workaround I've used successfully.

# Rename existing workspace to something unique
tf workspace /collection:http://yourserver:8080/tfs/DefaultCollection /newname:TEMPORARY /noprompt DEVBOX-SGY

# Unmap based on new (unique) name
tf workfold /unmap /workspace:TEMPORARY C:\Code\Tools

# Rename workspace back to original name to avoid side-effects
tf workspace /newname:DEVBOXSGY /noprompt TEMPORARY

Personally I was not able to use the workaround mentioned by sparkplug, because I needed something automation friendly.

suneg
  • 301
  • 3
  • 5