Blog

How to manage TFS workspaces

This tutorial is for managing the workspaces in Team Foundation Server (TFS) 2010.

Setup

All the  examples in this tutorial will use the following TFS server setup:

  • Server Name: Foo
  • Server Port: 8080
  • Collection: Bar

The resulting URL using the above setup is: http://foo:8080/tfs/bar

How to get a list of existing workspaces

You can get a list of workspaces for a specified TFS collection by using the workspaces command: tf workspaces /owner:* /collection:<tfs_collection_url>

  1. Open a Visual Studio Command Prompt
  2. Type: tfs workspaces /owner:* /collection:http://foo:8080/tfs/bar
  3. Press [Enter]

A list of all the workspaces that exist within the specified collection will be returned:

Figure 1a

There are 7 workspaces in the above results (Figure 1a):

  • 3 on the FOO computer
  • 2 on the JASON-PC1 computer
  • 1 on the ANDERS-PC1 computer
  • 1 on the SCOTT-PC1 computer

How to delete a workspace

You can delete a workspace by using the workspace command: tf workspace /delete /server:<tfs_collection_url> <workspace>;<owner> In this example, I'm going to delete the Jason-PC1 workspace owned by BGates. You'll note there are two workspaces named Jason-PC1 in "Figure 1a". By specifying the owner (BGates) along with the workspace (Jason-PC1), we ensure deletion of the correct workspace:

  1. Open a Visual Studio Command Prompt
  2. Type: tf workspace /delete /server:http://foo:8080/tfs/bar Jason-PC1;BGates
  3. Press [Enter]

You'll be prompted to confirm the workspace deletion:

Figure 2a
  1. Type: yes
  2. Press [Enter]

If all goes well, you will be returned to the command prompt when the deletion is complete.

Troubleshooting

If you get the following error:

TF249051: No URL can be found that corresponds to the following server name: <server_name>. Verify that the server name is correct.

Make sure you specify the Fully Qualified Domain Name (FQDN) for the collection. If your collection is named bar, don't specify /collection:bar. Specify /collection:http://foo:8080/tfs/bar. A good litmus test is making sure you can reach the URL in a browser, before using the command line.

Comments