How to connect to source control server using TF c

2020-07-17 06:21发布

问题:

I'm trying to run a commands using Tf Command-Line Utility I'm getting errors when trying to connect to TFS server. I'm not sure what tf tool is expecting as far as parameters.

It tells me to connect to workspaces by running tf /collection:TeamProjectCollectionUrl'

To get the TeamProjectCollectionUrl I went into Visual Studio Team Explorer, looked at properties of a project and copied URL property. The url starts with vstfs://

回答1:

You want to use the standard HTTP or HTTPS URL to specify your project collection. (This is the same URL that's shown in the connection dialog in Visual Studio.) For example:

http://tfs.contoso.com:8080/tfs/DefaultCollection

TFS installs on port 8080 by default, and (beginning in TFS 2010), the name of your project collection is the suffix.

Alternately, you shouldn't need to specify the project collection - if you run the tf resolve command from one of your working folders, it will determine the server information automatically. That is, if you have the workspace mapping:

$/Project/Source -> C:\Work\Source

If your current working directory is C:\Work\Source and run the tf command line client, it should locate your TFS workspace automatically.



回答2:

1- Add "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" path into Environment variable path.

2 - Create a batch file (simply copy and modify the below commands and save into file with ext .bat)

CLS tf get $/Project/Source /recursive /force

Pause

exit

3- Copy .bat file and place into your local Mapped folder and run.