Team Foundation Server – Build Automation
Team Foundation Server – Build Automation
In Legacy systems, most of the build and release management systems uses batch or command files to generate the automated build or nightly builds. The main task of the automated or nightly build is getting the latest code from source control and generates the build for further releases.
In early days, most of the systems uses source safe to maintain the source code control. In modern world, the development happens in remote locations or remote offices. To adopt the modern world requirements, Microsoft provided the new solution called Team foundation which maintains the code in single location and can be accessed in different locations like remote offices through web based protocols like HTTP and HTTPS. Its specifically is designed for internet, and works well in low band with scenarios too.
Here our main task is how to get the latest code from TFS. We just go through the steps to get the latest code from team foundation server. Before dig into to actual implementation we must confirm the following.
1. Team Foundation client is installed in your machine
2. Add TF.exe path into environment system variables.
Copy the below code and make it as batch file and run it in command prompt. Now you get the latest source code from your Team foundation server at the specified path.
@ECHO OFF
SET getpath="C:"\TFSGet
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
tf workspace /delete WORKSPACENAME /noprompt /s:TFSSERVER
tf workspace /new /s:TFSSERVER WORKSPACENAME /noprompt
REM unmap default WORKING FOLDER for newly created WORKSPACE
tf workfold /s:TFSSERVER /workspace:WORKSPACENAME /unmap $/
REM map WORKING FOLDER for newly created WORKSPACE
tf workfold /server:TFSSERVER /workspace:WORKSPACENAME /map $/TFS/TFSPATH %Getpath%
REM get the recent path through DOS command
pushd %Getpath%
REM get latest source from TFS
tf get /recursive /noprompt
ECHO.
REM move back to actual path through DOS command
popd
ECHO TFS get completed...
R.Arockia Jayaseelan
* Having 6+ Years of experience in Client Server and Web related Technologies.
* Working as a Software Engineer, USA.





