Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you force the deletion of a TFS 2010 workspace on a client when the TFS Server no longer exists?

I currently have a TFS 2010 Server running on SERVER-1. On my client (MY-CLIENT) I have VS2010 running and have a workspace associating SERVER-1 with \MY-CLIENT\Development. All is good.

I was playing around with setting up a different instance of TFS on SERVER-2. On my client, I deleted the original SERVER-1 workspace and created a new workspace associating SERVER-2 with \MY-CLIENT\Development. All is good.

Having finished my experiments with TFS on SERVER-2, I re-imaged the machine (deleting the TFS Server on SERVER-2).

I then went back to my client machine, reconnected to TFS on SERVER-1 and attempted to remap source control to my Development folder. However, am now receiving the error "The path \MY-CLIENT\Development is already mapped in workspace MY-CLIENT;SERVER-2\Steve." Now I have a problem.

So, I gather from this that I should have first deleted the SERVER-2 workspace BEFORE re-imaging the machine. Unfortunately, I did not do that.

Poking around in some forums, I realize that I can use a command line tool to perhaps delete it:

tf workspace /delete MY-CLIENT;SERVER-2\Steve

However, when I run this, I get a message indicating that "Team Foundation services are not available from server http://SERVER-2:8080/tfs/development."

So the question, then, is how do I force deletion of the SERVER-2 workspace on my client so that I can re-create my old SERVER-1 workspace?

like image 742
Steve Elmer Avatar asked Feb 15 '12 16:02

Steve Elmer


People also ask

How do I delete a workspace in Visual Studio?

right click in the workspace you'd like to remove and select the "Remove Folder from Workspace" item; the name of the workspace will become: "NO FOLDER OPENED" that is the one you'll get when you installed the very first time Visual Studio Code.


2 Answers

The working folder mappings for all the local workspaces is stored in the version control cache file. This allows you to bootstrap TFS clients, allowing them to locate the server information for a given local folder. In addition, it will provide the information for this test you're seeing, that prevents a local folder from being mapped to two different servers.

In order to clean this up (without trying to connect to the server), you can use the tf workspaces command (note the pluralization - the workspaces command operates on the list of workspaces, the workspace command operates on a workspace and generally requires connectivity to the server that workspace is located on.

To delete all workspaces for your deleted project collection, you can do:

tf workspaces /remove:* /collection:http://server-2:8080/tfs/DefaultCollection

(Obviously replacing the project collection URI with the URI for your deleted server.)

like image 91
Edward Thomson Avatar answered Sep 20 '22 03:09

Edward Thomson


I had exactly the same issue: After moving TFS server to another machine, I couldn't map to a local folder in VS2012 on the old machine because it was still associated with an old Workspace that TFS denied all existence of. After many hours (and days) searching Google and trying different things, none of which worked (including all the "tf" commands, deleting the local cache etc), this is how I eventually solved it:

  1. Edit the actual TFS collection database on the TFS server using SQL Management Studio Express (e.g. "Tfs_DefaultCollection")
  2. Look for the "dbo.tbl_Workspace" table and edit it
  3. You should see your "ghost" workspace(s) in here
  4. Delete the rows
  5. All is right in the world
like image 24
AndyM_LVB Avatar answered Sep 23 '22 03:09

AndyM_LVB