Script to download and build the latest codes from TFS

@cls
@echo off
@echo ***********Rebuilding MultiSite CodeBase
setlocal

set /a StartSecs=(%time:~0,2% * 60 * 60)+(%time:~3,2% * 60)+(%time:~6,2%)

Call "%VS71COMNTOOLS%vsvars32.bat"

del "C:\SourceBase\Company\BuildLog.txt"

@echo Building Utils
cd C:\SourceBase\Company\Utils
rem Get latest of utils
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\tf.exe" get $/root/Company/utils /force /recursive
rem build utils
@devenv C:\SourceBase\Company\Utils\Utils.sln /rebuild Debug /out "C:\SourceBase\Company\BuildLog.txt"

IF NOT %ERRORLEVEL% == 0 GOTO BUILDFAILURE


@echo Building Engine
cd C:\SourceBase\Company\Engine
rem Backup App.config
copy Application.config Application.config.bak /Y
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\tf.exe" get $/root/Company/Engine /force /recursive
copy Application.config.bak Application.config /Y
@devenv C:\SourceBase\Company\Engine\Engine.sln /rebuild Debug /out "C:\SourceBase\Company\BuildLog.txt"

IF NOT %ERRORLEVEL% == 0 GOTO BUILDFAILURE

@echo Building Business
cd C:\SourceBase\Company\Business
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\tf.exe" get $/root/Company/Business /force /recursive
@devenv C:\SourceBase\Company\Business\Business.sln /rebuild Debug /out "C:\SourceBase\Company\BuildLog.txt"

IF NOT %ERRORLEVEL% == 0 GOTO BUILDFAILURE

@echo Building UI
cd C:\SourceBase\Company\UI
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\tf.exe" get $/root/Company/UI /force /recursive
@devenv C:\SourceBase\Company\UI\UI.sln /rebuild Debug /out "C:\SourceBase\Company\BuildLog.txt"

IF NOT %ERRORLEVEL% == 0 GOTO BUILDFAILURE

set /a EndSecs=(%time:~0,2% * 60 * 60)+(%time:~3,2% * 60)+(%time:~6,2%)
set /a DurationSecs=%EndSecs%-%StartSecs%

if %DurationSecs% GEQ 60 (
   set /a FinalMins=%DurationSecs% / 60
   set /a FinalSecs=%DurationSecs% %% 60) else (
   set /a FinalMins=0
   set /a FinalSecs=%DurationSecs% )

@echo ************************************************
@echo Build Complete: Duration %FinalMins% mins,%FinalSecs% secs
@echo ************************************************
cd C:\SourceBase\Company
pause
EXIT /B

:BUILDFAILURE
@echo ************************************************
@echo Build Failed!
@echo ************************************************
@ECHO There was a build error. Please check the C:\SourceBase\Company\buildlog.txt file
@ECHO Please press enter to open the file
pause
start "notepad.exe C:\SourceBase\Company\buildlog.txt"
Script to download and build the latest codes from TFS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s