6

I am currently working with 2 different TFS servers. When running the tfs commands in Visual Studio Command Prompt, how is it determined which TFS server to work with. For example, the "tf status" requires a TFS server parameter indicating which server to run the command against. But, for other commands, like delete for example, how does it know which server to perform the operation against?

Thanks in advance.

laalto
  • 150,114
  • 66
  • 286
  • 303
user599236
  • 73
  • 1
  • 4

3 Answers3

7

In general, the command line tools (tf.exe, tfpt.exe) automatically determine the server based upon the workspace that the current directory is mapped to.

If you are running the command in a directory that is not mapped in any workspace, then you will need to explictly specify the server. Some commands require a workspace (e.g. tf edit) and you will not be able to run them without a local folder workspace mapping.

To explicitly specify a server:

  • For the Visual Studio 2008 tools, you can use /server:http://tfsserver:8080/
  • For the Visual Studio 2010 tools, you use /collection:http://tfsserver:8080/tfs/Collection/

/collection also applied to other commands like witadmin.exe

granth
  • 8,919
  • 1
  • 43
  • 60
4

Generally speaking, the TFS command-line commands will work with the workspace that the relevant files are in. So, if you are deleting a file using tf delete, TFS will use the workspace data. It doesn't actually perform the delete on the server until you check in, but when you do, TFS will use the server associated with the workspace.

Andrew
  • 14,325
  • 4
  • 43
  • 64
1

It works by looking in the current location and then determining if there is a workspace active in that location, if there it uses that one. Otherwise you have to tell it by pointing at the server or local source locations.

Preet Sangha
  • 64,563
  • 18
  • 145
  • 216