TFS automatically synchronizes batch commands for server-side files
At present, many times in our group's work, we need to automatically synchronize the server-side code on the TFS to the local, and find some solutions to the data http://bbs.scmroad.com/archiver/?tid-21003.html.
After testing, we summed up the following steps, I hope we have some reference.
Steps:
1. Click on the TFS directory list above the VS Source Explorer.
2. Create a new workspace for TFS.
3. Click Source Control Folder.
4. In the source folder, select the directory you want to synchronize from the server side.
5. In the local folder, select the locally synced folders.
6. Open the local registry and enter the key node path labeled in. Create a new key-value entry with the value of the key-value entry pointing to your TFS server address.
If the new key (e.g. TFSServer) is the parent of node (e.g. Servers) does not exist, you need to create one first.
7. Create a new batch file and write the following code. You can automatically synchronize TFS after you add a batch to a scheduled task in Windows.
@ECHO OFF
REM Local Mappings TFS on Project the path
SET getpath= "I:\TFSAutoDownload\TFSRFT_Gen850"
REM TFS on Project the path
SET tfspath= "$/geneva_qa/branches/release/geneva_8.5.up4/rfttrunk"
REM created for synchronization. TFS Workspace 's name
SET workspacename= "TFSAuto850"
REM registered in the registry TFS the key value
SET tfsserver= "TFSServer"
REM the locally installed TFS of the Explore path, the general default is to point to C Disk
SET vslocpath= "E:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
ECHO Trying TFS Get ...
ECHO.
REM IF not EXIST Create GetPath
IF not EXIST%getpath% MD%getpath%
REM if exists remove WORKSPACE and create NEW WORKSPACE
REM to start the synchronization, in the parameter list to give the connection account number and password
%vslocpath%\tf.exe "Workspace/delete%workspacename%/noprompt/s:%tfsserver%/login:dwei,!ufida1
%vslocpath%\tf.exe "workspace/new/s:%tfsserver%%workspacename%/noprompt/login:dwei,!ufida1
REM unmap Default working FOLDER for newly created WORKSPACE
%vslocpath%\tf.exe "workfold/s:%tfsserver%/workspace:%workspacename%/unmap $//login:dwei,!ufida1
REM Map working FOLDER for newly created WORKSPACE
%vslocpath%\tf.exe "workfold/server:%tfsserver%/workspace:%workspacename%/map%TFSPath%%Getpath%/login:dwei,! Ufida1
REM get the recent path through DOS command
pushd%getpath%
REM Get latest source from TFS
%vslocpath%\tf.exe "Get%tfspath%/recursive/noprompt/login:dwei,!ufida1
ECHO.
REM move back to actual path through DOS command
popd
ECHO TFS Get completed ...
TFS automatically synchronizes batch commands for server-side files