Thursday, 11 October 2012

Fairly useful TFS commands

Yesterday I had the pleasure of remapping the Team Foundation Server workspace that our automated build process uses, after we decided to move it from the system drive that was running out of space. This involved heavy use of the TFS's command line utility - tf.

I discovered that by using the tf workspace command you could alter a workspace to be public as described here. This is useful as not only does the automated account need access to the workspace but also anyone who wants to run the build manually but doesn't want to log in under the automated account.

You can also remap a workspace to a different working folder, using workfold;
tf workfold $/ <working folder>
 For example
tf workfold $/ c:\projects

Changes the current workspace to use c:\projects as the working folder.

tf workfold $/ c:\projects /workspace fred

Changes the working folder of the fred workspace to use c:\projects and removes the mapping to any old working folders.

tf workfold /workspace fred
Changes your current workspace to fred - with whatever working folder fred is mapped to.

Another useful command I found that wasn't at all well documented is

tf workspaces *;* <server name>

If you're an admin, this allows you to see all workspaces - not just your own, tf workspaces * just seems to look for workspaces called *!

No comments: