This wide- and large- screen layout may not work quite right without Javascript.

Maybe enable Javascript, then try again.

Chuck Kollars` Personal Home Visual Source Safe

Example Automatic Build Script

If you want to closely examine the charts/pictures/code on this page but they are not easily viewable on your device, note the web address and return to view it later from a device with a larger display screen.

This material on VSS is an archive from fall 1998, about two decades ago. First I changed jobs so I no longer had any association with VSS. Then after a couple more years I changed careers completely so I wasn't associated with high tech at all. Then after even more years I retired altogether. I've left the VSS material on this site for use by others, even though I no longer remember exactly what it's about, or even understand some of it.

VSS continues to be used and to provide integration with other products, even though the VSS software product itself has been retired. Almost all VSS consulting services have disappeared. Microsoft Mainstream Support is no longer available for any version of VSS. And the end is near even for Microsoft Extended Support for VSS2005. As a result, roll your own support may become more important, and the experience with VSS related by these pages may turn out to be quite useful to some despite its great age.

This material reflects experience with VSS5. The user interfaces and the feature set in VSS6 were virtually identical, so almost all of this material continued to apply for several years. But I never had any detailed knowledge of the user interfaces or feature set of VSS2005, and so simply assumed most parts of this material still applied.

This script, which was used in production, implements the recommended automatic building strategy on a build platform of Microsoft tools such as VC++/MSDEV and VSS.

This script illustrates several tricks for using the Command Shell in Windows NT 4 with the NT Resource Kit (the "extended batch language") --including the conversion of relative paths to absolute paths so the working directory can be changed safely. And it illustrates techniques for unattended handling of several common issues:

If you decide to use the DOS/Windows batch language for your scripts, be sure to insist on the "extended" version (the new Command Shell) that first became available with Windows NT 4 and is implemented by CMD rather than COMMAND. That version is well described by the book Windows NT Shell Scripting by Tim Hill. Earlier versions of the DOS/Windows batch language were not anywhere near powerful enough. Do not attempt to implement an automatic build system with them.

This script of course depends on the both the directory structure it's working with and several files that already exist in that directory structure. This other information is not shown.

This script is composed of four separate files:

BUILD.BAT

@ECHO OFF
if NOT "%DEBUG%" == "" @ECHO ON
REM this batch file will build the DocsBinder 
REM     from the source repository.
REM             assumes:
REM                     1. vss client exists and is in path
REM                     2. VC5_PROGS environment variable points to tools
REM                     3. Developer has exported _current_ makefiles
REM                        and these are in VSS
REM                     (Previous assumption that DevStudion can run the
REM                     BuildDocsBinderRelease macro is no longer true.)
REM
REM (Note that the .\Sources folder is just a picture of what the directory
REM  structure might look like at the beginning of a build.  It isn't 
REM  actually used for anything.)
REM
REM To slow this script down and see what's happening, 
REM before launching it in the same command box SET DEBUG=1

REM right at the very beginning, create our own sandbox
SETLOCAL

set logfile=CON
if "%7" NEQ "" for /F "tokens=1,2,3,4,*" %%a in ('dir "%7" ^| find "Directory of"') do set logfile=%%c\%~nx7

rem ensure that we have a command interpreter that can handle this script
VERIFY OTHER 2>NUL
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 goto ERROR_NOEXTENSIONS
ENDLOCAL

if NOT "%1"=="" goto notallblank
if NOT "%2"=="" goto notallblank
if NOT "%3"=="" goto notallblank 
if NOT "%4"=="" goto notallblank
if NOT "%5"=="" goto notallblank
if NOT "%6"=="" goto notallblank
if NOT "%7"=="" goto notallblank
REM On machines without NT Resource Kit, following executable "choice"
REM will not be found. So line will not be executed, and ERRORLEVEL will
REM be set to 9009. This effectively answers "No" without ever displaying
REM the question, which is exactly what's desired. 
choice /T:y,15 "Supply default args BUILDANDPACKAGE RELEASE INCREMENT $/DOCSBinder20 D:\D4W\DBIND unused C:\CM\BINDER\LOGS\BUILD20.LOG" 
if ERRORLEVEL 2 goto usg_msg
%0 BUILDANDPACKAGE RELEASE INCREMENT $/DOCSBinder20 D:\D4W\DBIND unused C:\CM\BINDER\LOGS\BUILD20.LOG 
echo >>>Returned unexpectedly from %0<<<
goto :eof
:notallblank

if %logfile% == CON goto :nologhead
rem Create/truncate the logfile here at the start so all commands
rem below can append to it without worrying about whether or not
rem they are first.  Since we're doing this, we might as well put
rem something meaningful in the file.
echo ---Details of building of DOCS Binder--- >%logfile%
date /T >>%logfile%
time /T >>%logfile% 
echo. >>%logfile%
:nologhead

echo Entered BUILD %*

if "%1"=="" goto usg_msg
if "%2"=="" goto usg_msg
if "%3"=="" goto usg_msg
if "%4"=="" goto usg_msg
if "%5"=="" goto usg_msg
if "%6"=="" goto usg_msg

set temparg=%1
set temparg=%temparg:~0,1
if /I "%1"=="BuildAndPackage" goto arg1buildandpackage
if /I "%1"=="BuildAndUse" goto arg1buildanduse
if /I "%temparg%"=="B" goto arg1build
if /I "%temparg%"=="C" goto arg1clean
if /I "%temparg%"=="P" goto arg1package
if /I "%temparg%"=="U" goto arg1use
goto usg_msg
:arg1clean
set buildtype=CLEAN
goto arg1ok
:arg1build
set buildtype=BUILD
goto arg1ok
:arg1package
set buildtype=PACKAGE
goto arg1ok
:arg1use
set buildtype=USE
goto arg1ok
:arg1buildandpackage
set buildtype=BUILDANDPACKAGE
goto arg1ok
:arg1buildanduse
set buildtype=BUILDANDUSE
goto arg1ok
:arg1ok

set temparg=%2
set temparg=%temparg:~0,1
if /I "%temparg%"=="R" goto arg2release
if /I "%temparg%"=="D" goto arg2debug
goto usg_msg
:arg2release
set configuration=Release
goto arg2ok
:arg2debug
set configuration=Debug
goto arg2ok
:arg2ok

set temparg=%3
set temparg=%temparg:~0,1
if /I "%temparg%"=="I" goto arg3yes
if /I "%temparg%"=="Y" goto arg3yes
if /I "%temparg%"=="N" goto arg3no
if /I "%temparg%"=="X" goto arg3no
if "%temparg%"=="-"goto arg3no
if "%temparg%"=="."goto arg3no
goto usg_msg
:arg3yes
set increment=INCREMENT
goto arg3ok
:arg3no
set increment=NOINCREMENT
goto arg3ok
:arg3ok

set VSSProject=%4
if "%VSSProject%"=="." set VSSProject=NOGET
if "%VSSProject%"=="-" set VSSProject=NOGET
set temparg=%VSSProject:~0,1%
if /I "%temparg%"=="N" set VssProject=NOGET
if "%temparg%"=="\" goto usg_msg
if "%temparg%"=="/" goto usg_msg
set temparg=%VSSProject:~1,1%
if "%temparg%"==":" goto usg_msg
if "%VSSProject%"=="NOGET" goto argok4
SS DIR -R- "%VssProject%" >nul 2>&1
REM if it exists, VSS should be able to find it
if ERRORLEVEL 1 goto usg_msg 
:argok4

REM check for a combination that we don't support
if NOT "%increment%"=="INCREMENT" goto nargok1
if NOT "%VSSProject%"=="NOGET" goto nargok1
goto :ERROR_INCNOGET
:nargok1

REM not much check on arg5 (other than non-blank)
set SourcePath=%5
REM unless package only or use only, in which case it must exist
if /I "%buildtype"=="PACKAGE" goto checkarg5
if /I "%buildtype"=="USE" goto checkarg5
goto argok5
:checkarg5
if EXIST %5 goto nargok5
goto :ERROR_INSNOSRC
:argok5

REM no check on arg6 (other than non-blank), any path okay for input
set TargetPath=%6

if NOT "%DEBUG%" == "" pause

REM **************************
REM *
REM * STEP1: Environment variables and initialization
REM *
REM **************************
:STEP1

REM Common setup used for all

echo Starting STEP1: Environment variables and initialization

REM assume other build utils can be found in the place we are executing from
REM (this odd-looking construct finds out the directory we're running from and puts it in a var)
for /F "tokens=1,2,3,4,*" %%a in ('dir "%~dp0" ^| find "Directory of"') do set BUILDPATH=%%c
for /F "tokens=1,2,3,4,*" %%a in ('dir "%LOGFILE%" ^| find "Directory of"') do set LOGPATH=%%c
if "%LOGFILE%" == "CON" for /F %%i in ("%BUILDPATH%") do set LOGPATH=%%~dpi\logs
for /F %%i in ("%LOGFILE%") do set DAYUID=%%~nxi
set DAYUID=%DAYUID:~0,4%
if %LOGFILE% == CON for /F "tokens=1,2,*" %%i in ('date /T') do for /F "tokens=1,2,3,* delims=/" %%s in ("%%j") do set DAYUID=%%s%%t
mkdir "%LOGPATH%" >nul 2>&1
echo For details see %LOGPATH%\%DAYUID%* >>%logfile%

if NOT "%DEBUG%" == "" pause

SET PROJECT_NAME=DocsBinder
SET BUILDINFO_PATH=%PROJECT_NAME%\RES
SET BUILDINFO_FILE=BUILDINFO.TXT
SET BUILDINFO=%BUILDINFO_PATH%\%BUILDINFO_FILE%
REM initialize these to unset/nothing, they MAY be given a value later
SET BUILD_LABEL=
SET BUILD_NUMBER=
SET BUILD_COMMENT=

if EXIST %SourcePath% goto SOURCEPATH_EXISTS
mkdir %SourcePath%
:SOURCEPATH_EXISTS

set SYSDIR=
if EXIST "%Windir%\system" set SYSDIR=%Windir%\system
if EXIST "%Windir%\system32" set SYSDIR=%Windir%\system32

REM environment variables IDE6_HOME and IDE6_PROGS 
REM (and VC6_HOME and VC6_PROGS) should already be set per machine,
REM but if they're not set them to some value that's often right anyway
REM - default below (used only when environment variables not set)
REM may not be right for some developer machines - 
REM - so long as environment variables are set default will never be 
REM used so it will work okay on all set up systems anyway -
IF "%IDE6_HOME%" == "" SET IDE6_HOME=c:\program files\microsoft visual studio\common\msdev98 
IF "%IDE6_PROGS%" == "" SET IDE6_PROGS=c:\program files\microsoft visual studio\common\msdev98\bin
IF "%VC6_HOME%" == "" SET VC6_HOME=c:\program files\microsoft visual studio\vc98 
IF "%VC6_PROGS%" == "" SET VC6_PROGS=c:\program files\microsoft visual studio\vc98\bin 

if NOT "%DEBUG%" == "" pause

REM do substitutions on contents of list file so we can use it later
echo # Temporary copy of stagedfiles.txt with substitutions performed >%BUILDPATH%\stagedfiles.eval
FOR /F "tokens=* eol=#" %%i in (%BUILDPATH%\stagedfiles.txt) do for /F "tokens=*" %%s in ('echo %%i') do echo %%s >>%BUILDPATH%\stagedfiles.eval

if NOT "%DEBUG%" == "" pause

REM From here on many paths are relative
REM So pushd into the right directory
pushd %SourcePath%

IF "%buildtype%" == "CLEAN" GOTO STEP10

REM IF EXIST "%SourcePath%\%PROJECT_NAME%" goto TARGETPATH_EXISTS
REM mkdir "%SourcePath%" >nul 2>&1
REM :TARGETPATH_EXISTS

IF "%buildtype%" == "PACKAGE" GOTO STEP6
IF "%buildtype%" == "USE" GOTO STEP11
REM buildtypes BUILD, BUILDANDPACKAGE, and BUILDANDUSE all fall through to here

IF "%VSSProject%"=="NOGET" goto VSS_WORKDIR_DONE
IF "%VSSProject%"=="" goto VSS_WORKDIR_DONE
IF "%SourcePath%"=="" goto VSS_WORKDIR_DONE
SS cp "%VSSProject%" >"%LOGPATH%\%DAYUID%ss1.log" 2>&1
if errorlevel 2 goto ERROR_VSSFAILURE
REM Working Folder setting may not be necessary to the correct action of other
REM SS commands. We do it anyway partly so if something goes wrong and we have
REM to run VSS manually, it already has the right Working Folder setting to
REM point at where the problem occurred. 
SS workfold "%VSSProject%" "%SourcePath%" >>"%LOGPATH%\%DAYUID%ss1.log" 2>>&1
if errorlevel 2 goto ERROR_VSSFAILURE
:VSS_WORKDIR_DONE

if NOT "%DEBUG%" == "" pause


REM **************************
REM *
REM * STEP2: check-out build info resource file from VSS,
REM *           increment the build number, check-in build info,
REM *           and label the project within VSS using the new 
REM *           build number.  
REM *
REM **************************
:STEP2

echo Starting STEP2: Handle BUILD_NUMBER, in VSS if necessary

IF "%increment%"=="NOINCREMENT" GOTO STEP2DONE

REM check-out BUILDINFO.TXT file and increment it
mkdir "%SourcePath%\%BUILDINFO_PATH%" >nul 2>&1
REM get rid of any old file that might already be here
erase /F "%SourcePath%\%BUILDINFO%" >nul 2>&1
SS Checkout -I-Y -GF -GTM "-GL%SourcePath%\%BUILDINFO_PATH%" -C- "%VSSProject%/%BUILDINFO%" >"%LOGPATH%\%DAYUID%ss2.log" 2>&1 
if errorlevel 2 goto ERROR_VSSFAILURE
IF NOT EXIST "%SourcePath%\%BUILDINFO%" GOTO ERROR_BUILDINFONOTFOUND

if NOT "%DEBUG%" == "" pause

REM increment build number 
IF NOT "%DEBUG%"=="" @echo. BuildInfo File Before: 
IF NOT "%DEBUG%"=="" type "%BUILDINFO%"
REM get the old number out of the file 
FOR /F "tokens=1,*" %%a IN (%SourcePath%\%BUILDINFO%) do SET BUILD_NUMBER=%%a
FOR /F "tokens=1,*" %%a IN (%SourcePath%\%BUILDINFO%) do SET BUILD_COMMENT=%%b
REM increment it 
set /A BUILD_NUMBER+=1 
set INCLEVEL=%ERRORLEVEL%
REM put it back
echo %BUILD_NUMBER% %BUILD_COMMENT% >"%SourcePath%\%BUILDINFO%"
IF NOT "%DEBUG%"=="" @echo. BuildInfo File After:
IF NOT "%DEBUG%"=="" type "%BUILDINFO%"
echo BUILD_NUMBER now %BUILD_NUMBER%, INCLEVEL(ERRORLEVEL) was %INCLEVEL% >>%logfile%
REM Can't check %errorlevel% after SET, as it hasn't necessarily been set
REM IF %INCLEVEL% NEQ 0 GOTO ERROR_INCBUILDFAILED

REM check modified file containing new build number back into VSS
SS Checkin -I-Y "-GL%SourcePath%\%BUILDINFO_PATH%" "-CRoll Version Number" "%VSSProject%/%BUILDINFO%" >>"%LOGPATH%\%DAYUID%ss2.log" 2>>&1
if errorlevel 2 goto ERROR_VSSFAILURE

if NOT "%DEBUG%" == "" pause

REM get the number out of the file we just modified
FOR /F "" %%a IN (%SourcePath%\%BUILDINFO%) do SET BUILD_LABEL=Build Number %%a
FOR /F "" %%a IN (%SourcePath%\%BUILDINFO%) do SET BUILD_NUMBER=%%a

REM label the root of the project with this build number
SS Label -I-N "-L%BUILD_NUMBER%" "-C%BUILD_LABEL%" "%VSSProject%" >"%LOGPATH%\%DAYUID%ss3.log" 2>&1
if errorlevel 2 goto ERROR_VSSFAILURE

:STEP2DONE

if NOT "%DEBUG%" == "" pause


REM **************************
REM *
REM * STEP3: Pull sources from VSS
REM *
REM **************************
:STEP3

echo Starting STEP3: Pull sources from VSS
 
IF "%VSSProject%"=="NOGET" goto STEP3DONE

SET VERSIONPARAMS=
IF NOT "%BUILD_NUMBER%"=="" SET VERSIONPARAMS=-VL%BUILD_NUMBER%

SS Get -W -GF -GCK -GWR -GTM -R -I- "%VERSIONPARAMS%" "%VSSProject%" >"%LOGPATH%\%DAYUID%ss4.log" 2>&1
if errorlevel 2 goto ERROR_VSSFAILURE

REM do some cleanup of what we got out of VSS
erase /F /S /Q *.scc >nul 2>&1

:STEP3DONE

if NOT "%DEBUG%" == "" pause


REM **************************
REM *
REM * STEP4: Attempt to build the application and its components
REM *
REM **************************
:STEP4

echo Starting STEP4: Attempt to build the application and its components

erase /F "%LOGPATH%\%DAYUID%vc*.log" >nul 2>&1
erase /F "%LOGPATH%\%DAYUID%vc*.err" >nul 2>&1

if NOT EXIST "%IDE6_PROGS%\msdev.exe" goto ERROR_NOVC

REM Batch build capability in VS6 does almost all the work
"%IDE6_PROGS%\msdev" "%SourcePath%\%PROJECT_NAME%.DSW" /MAKE "ALL - %Configuration%" /REBUILD /OUT "%LOGPATH%\%DAYUID%vcX.log"

:STEP4DONE

if NOT "%DEBUG%" == "" pause

REM **************************
REM *
REM * STEP5: Make a reasonable check components were built correctly.
REM *
REM **************************
:STEP5

echo Starting STEP5: Make a reasonable check components were built correctly.

FOR /F "tokens=1,2,* delims=, eol=#" %%a IN (%BUILDPATH%\stagedfiles.eval) DO if NOT EXIST "%SourcePath%\%%a" goto ERROR_MISSINGCOMPONENT

:STEP5DONE

if NOT "%DEBUG%" == "" pause

REM **************************
REM *
REM * STEP6: Stage components for package/use
REM *
REM **************************
REM Double-check that we really should be here
if "%buildtype%" == "BUILD" goto STEP6
if "%buildtype%" == "PACKAGE" goto STEP6
if "%buildtype%" == "USE" goto STEP6
if "%buildtype%" == "BUILDANDPACKAGE" goto STEP6
if "%buildtype%" == "BUILDANDUSE" goto STEP6
popd
goto :STEP99

:STEP6

echo Starting STEP6: Stage components for package/use

REM From here on many paths are relative
REM (IShield3 doesn't handle long foldernames right.)
REM So pushd into the right directory
pushd %SourcePath%\installer

erase /F "%LOGPATH%\%DAYUID%is*.log" >nul 2>&1
erase /F "%LOGPATH%\%DAYUID%is*.err" >nul 2>&1

IF NOT EXIST "Data\%configuration%\program" mkdir "Data\%configuration%\program"
REM Completely get rid of all previous programs
erase /F /S /Q "data\%configuration%\program\*" >nul 2>&1

if NOT "%DEBUG%" == "" pause

rem Note all below requires Borland 'touch', not Microsoft 'touch'
rem (Borland has more features; option switches are not right for Microsoft)
touch %TEMP%\tt1.txt >nul 2>&1
touch -r%TEMP%\tt1.txt %TEMP%\tt2.txt >nul 2>&1
if ERRORLEVEL 1 goto ERROR_WRONGTOUCH
touch "relstamp.txt" >nul 2>&1
rem set time part of timestamp to an encoding of the release
rem if tens of minutes digit > 6, use modulo 6 to make it fit
touch -t02:00 "relstamp.txt" >nul 2>&1
rem Use "relstamp" for very detailed dates, "genstamp" for nearest several months
rem ("genstamp" avoids frequent changes to timedatestamps for infrequently changed items)
touch -t02:00 -d01/07/98 "genstamp.txt" >nul 2>&1

if NOT "%DEBUG%" == "" pause

echo Copy result files to place where image builder will pick them up >"%LOGPATH%\%DAYUID%is1.log"
REM to change which files are distributed, modify "stagedfiles.txt", not this file
FOR /F "tokens=1,2,* delims=, eol=#" %%a IN (%BUILDPATH%\stagedfiles.eval) DO FOR /F %%i in ("%SourcePath%\%%b") DO mkdir %%~dpi >>"%LOGPATH%\%DAYUID%is1.log" 2>>&1
echo.F >%TEMP%\xcopy.in
FOR /F "tokens=1,2,* delims=, eol=#" %%a IN (%BUILDPATH%\stagedfiles.eval) DO xcopy "%SourcePath%\%%a" "%SourcePath%\%%b" /R <%TEMP%\xcopy.in >>"%LOGPATH%\%DAYUID%is1.log" 2>>&1

if NOT "%DEBUG%" == "" pause

rem have to make everything writable, otherwise touch will fail
FOR /F "tokens=1,2,* delims=, eol=#" %%a IN (%BUILDPATH%\stagedfiles.eval) DO FOR /F %%i in ("%SourcePath%\%%b") DO attrib  /S -R  "%%~dpi\*" >>"%LOGPATH%\%DAYUID%is2.log" 2>>&1
rem set the timestamp
FOR /F "tokens=1,2,* delims=, eol=#" %%a IN (%BUILDPATH%\stagedfiles.eval) DO FOR /F %%i in ("%SourcePath%\%%b") DO touch -c -s -rrelstamp.txt "%%~dpi\*" >>"%LOGPATH%\%DAYUID%is2.log" 2>>&1

if NOT "%DEBUG%" == "" pause

REM figure out where to go next
if "%buildtype%" == "PACKAGE" goto STEP7
if "%buildtype%" == "BUILDANDPACKAGE" goto STEP7
if "%buildtype%" == "USE" goto STEP11
if "%buildtype%" == "BUILDANDUSE" goto STEP11
goto STEP99

:STEP6DONE

if NOT "%DEBUG%" == "" pause


REM **************************
REM *
REM * STEP7: Attempt to build the installer program
REM *
REM **************************
:STEP7

echo Starting STEP7: Attempt to build the installer program

if "%ISHIELD3_PROGS%" == "" goto ERROR_NOIS
if NOT EXIST "%ISHIELD3_PROGS%\Compile.EXE" goto ERROR_NOIS

REM be sure to get rid of any previous result
erase /F "setup\setup.ins" >nul 2>&1
erase /F "setup\setup.dbg" >nul 2>&1
erase /F "setup\setup.pkg" >nul 2>&1

set CDEBUGFLAG=
IF /I "%configuration%"=="Debug" SET CDEBUGFLAG=/g

"%ISHIELD3_PROGS%\compile" -i%ISHIELD3_INC% setup\setup.rul %CDEBUGFLAG% >"%LOGPATH%\%DAYUID%is3.log" 2>&1

:STEP7DONE

if NOT "%DEBUG%" == "" pause

REM **************************
REM *
REM * STEP8: check that the installer built correctly 
REM *
REM **************************
:STEP8

echo Starting STEP8: check that the installer built correctly

if NOT EXIST "setup\setup.ins" goto ERROR_BUILDINSTALLFAILED 

:STEP8DONE

if NOT "%DEBUG%" == "" pause

REM **************************
REM *
REM * STEP9: Attempt to build a distribution image
REM *
REM **************************
:STEP9

echo Starting STEP9: Attempt to build a distribution image

IF NOT EXIST Image mkdir Image
REM Completely get rid of any previous partial image
attrib -R /S "image\*" >nul 2>&1
erase /F /S /Q "Image\*" >nul 2>&1
REM also remove any .SCC files that may exist
erase /F /S /Q "data\*.scc" >nul 2>&1

REM copy the installation program we just built
copy "setup\setup.ins" "Image" >>%logfile%
IF /I "%configuration%"=="Debug" COPY "setup\setup.dbg" "Image" >>%logfile%

"%ISHIELD3_PROGS%\icomp" -i data\%configuration%\*.* image\dbdata.z >"%LOGPATH%\%DAYUID%is4.log" 2>&1

REM Create packing list corresponding to archive we just created
REM (used for determing file sizes)
pushd image
"%ISHIELD3_PROGS%\packlist" ..\setup\setup.lst >>"%LOGPATH%\%DAYUID%is4.log" 2>>&1
popd

if NOT "%DEBUG%" == "" pause

REM Copy needed InstallShield fixed files to output image
FOR /F "tokens=1,2,* delims=, eol=#" %%a IN (%BUILDPATH%\installfiles.txt) DO copy "%ISHIELD3_PROGS%\%%a" image >>%logfile%

REM Copy needed fixed files of our own (probably only README) to output image
attrib -R "image\*" >nul 2>&1
copy "data\%configuration%\*.*" image >>%logfile%

if NOT "%DEBUG%" == "" pause

echo Adding to what's initially in _SETUP.LIB >"%LOGPATH%\%DAYUID%is5.log"
rem start with CTL3D.DLL, _ISRES.DLL, and UNINST16.EXE already in _SETUP.LIB
FOR /F "tokens=1,2,* delims=, eol=#" %%a IN (%BUILDPATH%\installmembers.txt) DO "%ISHIELD3_PROGS%\icomp" %%a image\_setup.lib >>"%LOGPATH%\%DAYUID%is5.log" 2>>&1

REM get rid of any extra files that may have crept in here
erase /F /S /Q "image\*.scc" >nul 2>&1

REM End of installer, restore directory
popd

goto STEP99

:STEP9DONE

if NOT "%DEBUG%" == "" pause

REM **************************
REM *
REM * STEP10: CLEAN_BUILDS - cleanup by deleting all the source files and
REM *                           all files generated by the build.
REM *
REM **************************
:STEP10

echo Starting STEP10: CLEANup all source files and generated files

choice "Are you sure you want to delete this build "
IF %ERRORLEVEL% EQU 1 GOTO CONTINUE_CLEAN
ECHO ***  CLEAN cancelled by user. *** >>%logfile%
GOTO STEP10DONE

:CONTINUE_CLEAN
ATTRIB -R DOCSBINDER.MAK
erase /F DOCSBINDER.MAK
erase /F DEFBINDERVIEWER.MAK
erase /F "%LOGPATH%\%DAYUID%ss*.log"
erase /F "%LOGPATH%\%DAYUID%ss*.err"
erase /F "%LOGPATH%\%DAYUID%vc*.log"
erase /F "%LOGPATH%\%DAYUID%vc*.err"
erase /F "%LOGPATH%\%DAYUID%is*.log"
erase /F "%LOGPATH%\%DAYUID%is*.err"
dir /ad /b > cleanup.arf
FOR /F "" %%a IN (cleanup.arf) do rd %%a /s /q
erase /F cleanup.arf
REM nmake /f "..\DOCSBinder.MAK" /x "%LOGPATH%\%DAYUID%vcA.err" /E CFG="DocsBinder - Win32 %configuration%" CLEAN >>"%LOGPATH%\%DAYUID%vcX.log"
REM nmake /f "..\DOCSBinder.MAK" /x "%LOGPATH%\%DAYUID%vcB.err" /E CFG="DocsBinder - Win32 %configuration%" CLEAN >>"%LOGPATH%\%DAYUID%vcX.log"
REM nmake /f "..\DefBinderViewer.MAK" /x "%LOGPATH%\%DAYUID%vcC.err" /E CFG="DefBinderViewer - Win32 %configuration%" CLEAN >>"%LOGPATH%\%DAYUID%vcX.log"
REM nmake /f "..\DefBinderViewer.MAK" /x "%LOGPATH%\%DAYUID%vcD.err" /E CFG="DefBinderViewer - Win32 %configuration%" CLEAN >>"%LOGPATH%\%DAYUID%vcX.log"
%IDE6_PROGS%\msdev "%SourceFile%\%PROJECT_NAME%.DSW /MAKE /CLEAN /OUT "%LOGPATH%\%DAYUID%vcX.log"

if NOT "%DEBUG%" == "" pause

goto STEP99

:STEP10DONE

if NOT "%DEBUG%" == "" pause

REM **************************
REM *
REM * STEP11: Set up SYSDIR as necessary so programs can be registered and executed locally

REM *
REM **************************
:STEP11

echo Starting STEP11: Set up SYSDIR as necessary so programs can be registered and executed locally

XCOPY /D /F "%SourcePath%\installer\data\%configuration%\system\*.*" "%SYSDIR%"

if NOT "%DEBUG%" == "" pause

:STEP11DONE

if NOT "%DEBUG%" == "" pause


REM **************************
REM *
REM * STEP12: Register programs so they can be executed locally
REM *
REM **************************
:STEP12

echo Starting STEP12: Register programs so they can be executed locally

REM if Debug version, this requires a newer version of the MFCxyzD.DLLs
REM if executed when the older version is in place, it will hang
REM TBD
"%SourcePath%\%Configuration%\docsbndr.EXE" /REGSERVER
REGSVR32 /S /C "%SourcePath%\%Configuration%\DefBndrV.OCX"

if NOT "%DEBUG%" == "" pause

goto STEP99

:STEP12DONE

if NOT "%DEBUG%" == "" pause

REM **************************
REM *
REM * STEP99: All done, clean up and exit
REM *
REM **************************
:STEP99

echo Starting STEP99: All done, clean up and exit

REM done with our own sandbox - every path goes through this common exit point
ENDLOCAL

REM End of build, restore directory
popd

goto :eof

:STEP99DONE

if NOT "%DEBUG%" == "" pause



REM **************************
REM *
REM * ERROR HANDLING
REM *
REM **************************

goto :eof

:ERROR_NOUSER
ECHO ***  No VSS User name specified ***
ECHO ***  No VSS User name specified *** >>%logfile%
GOTO usg_msg

:ERROR_NOPSWD
ECHO ***  No VSS password specified ***
ECHO ***  No VSS password specified *** >>%logfile% 
GOTO usg_msg

:ERROR_NOEXTENSIONS
ECHO ***  Could not enable "command extensions" (WinNT4 only?) *** 
ECHO ***  Could not enable "command extensions" (WinNT4 only?) *** >>%logfile% 
GOTO usg_msg

:ERROR_NORESKIT
ECHO ***  Extra commands not found (NT Resource Kit not in PATH?) *** 
ECHO ***  Extra commands not found (NT Resource Kit not in PATH?) *** >>%logfile%
GOTO usg_msg

:ERROR_NOAPPLICATION
ECHO ***  Application Failed to build *** 
ECHO ***  Application Failed to build *** >>%logfile%
GOTO usg_msg

:ERROR_NOVC
ECHO ***  Cannot locate VC/MSDEV component of Visual Studio *** 
ECHO ***  Cannot locate VC/MSDEV component of Visual Studio *** >>%logfile%
GOTO usg_msg

:ERROR_NOIS
ECHO ***  Cannot locate InstallShield3 (Env ISHIELD3_HOME, ISHIELD3_PROGS, ISHIELD3_INC) *** 
ECHO ***  Cannot locate InstallShield3 (Env ISHIELD3_HOME, ISHIELD3_PROGS, ISHIELD3_INC) *** >>%logfile%
GOTO usg_msg

:ERROR_MISSINGCOMPONENT
ECHO ***  A component failed to build *** 
ECHO ***  A component failed to build *** >>%logfile%
GOTO usg_msg

:ERROR_BUILDINFONOTFOUND
ECHO ***  BuildInfo.txt not found *** 
ECHO ***  BuildInfo.txt not found *** >>%logfile%
GOTO usg_msg

:ERROR_INCNOGET
ECHO ***  Can't increment build number yet not get source from VSS *** 
ECHO ***  Can't increment build number yet not get source from VSS *** >>%logfile%
GOTO usg_msg

:ERROR_INSNOSRC
ECHO ***  Can't do PACKAGE/USE only because BUILD hasn't been done (no SourcePath) 
ECHO ***  Can't do PACKAGE/USE only because BUILD hasn't been done (no SourcePath) >>%logfile%
GOTO usg_msg

:ERROR_INCBUILDFAILED
ECHO ***  Unable to Increment build number *** 
ECHO ***  Unable to Increment build number *** >>%logfile%
GOTO usg_msg

:ERROR_VSSFAILURE
ECHO ***  VSS did not complete requested operation successfully *** 
ECHO ***  VSS did not complete requested operation successfully *** >>%logfile%
GOTO usg_msg

:ERROR_BUILDINSTALLFAILED
ECHO ***  Did not complete building installation package (SETUP.RUL didn't compile?) *** 
ECHO ***  Did not complete building installation package (SETUP.RUL didn't compile?) *** >>%logfile%
GOTO usg_msg

:ERROR_WRONGTOUCH
ECHO ***  Borland version of TOUCH must be first in path (NTResKit version not acceptable) ***
ECHO ***  Borland version of TOUCH must be first in path (NTResKit version not acceptable) *** >>%logfile%
GOTO usg_msg


:usg_msg

if NOT "%DEBUG%" == "" pause

Echo Usage: Build {buildtype} {configuration} {increment} {project} {sourcepath} {targetpath} [logfile] >>%logfile%
Echo       buildtype: Clean or Build or Package or Use >>%logfile%
Echo          or BuildAndPackage or BuildAndUse >>%logfile%
Echo          (use Package to rebuild distribution package) >>%logfile%
Echo       configuration: Release or Debug >>%logfile%
Echo       increment: Increment or Noincrement >>%logfile%
Echo          (build number stored inside VSS and used as VSS label) >>%logfile%
Echo       project >>%logfile%
Echo          Location in VSS of root of DOCS Binder project >>%logfile%
Echo          (. means do not do VSS Get) >>%logfile%
Echo       sourcepath >>%logfile%
Echo          Path to where input should come from (must exist) >>%logfile%
Echo       targetpath >>%logfile%
Echo          Path to where output should be placed >>%logfile%
Echo          CURRENTLY UNUSED, EVERYTHING GOES IN SOURCEPATH >>%logfile%
Echo       logfile >>%logfile%
Echo          Filename where all output should be logged, >>%logfile%
Echo          or CON or nothing for no logging (interactive) >>%logfile%
Echo ex. build buildandpackage release increment $/DOCSBinder20 e:\d4w\docsbinder\source e:\d4w\docsbinder\install >>%logfile%

goto STEP99

STAGEDFILES.TXT

# Built files copied to where creation of install image can find them
# This is essentially the "pick list" for the distribution contents
# Use this to _not_ distribute unwanted output such as .EXP.
#
# Since this file may contain %xyz% variables, and since the command
# language doesn't seem to handle this straightforwardly, this file
# is pre-evaluated at the beginning of a run just to substitute
# any %xyz% variables it may contain.
#
%configuration%\DocsBndr.exe,Installer\Data\%configuration%\Program\DocsBndr.exe
%configuration%\DefBndrV.ocx,Installer\Data\%configuration%\Program\DefBndrV.ocx
%configuration%\DBTree.dll,Installer\Data\%configuration%\Program\DBTree.dll
%configuration%\DBPWR.dll,Installer\Data\%configuration%\Program\DBPWR.dll
%configuration%\DBDOS.dll,Installer\Data\%configuration%\Program\DBDOS.dll
#DocsBinder\automationinterface.htm,Installer\Data\PCI\automationinterface.htm
#DocsBinder\publishinginterface.htm,Installer\Data\PCI\publishinginterface.htm

INSTALLFILES.TXT

# Redistributable parts of InstallShield, all in %ISHIELD3_PROGS%
setup.exe
_inst32i.ex_
#_inst16.ex_
_isdel.exe
_setup.dll
_setup.lib

INSTALLMEMBERS.TXT

#paths are relative to %SourcePath%\installer
setup\corecomp.ini
setup\titlebit.bmp
setup\splash1.bmp
#isdel.exe

Location: (N) 42.680943, (W) -70.839384
 (North America> USA> Massachusetts> Boston> Metro North> Ipswich)

Email comments to Chuck Kollars
Time: UTC-5 (USA Eastern Time Zone)
 (UTC-4 summertime --"daylight savings time")

Peruse Chuck Kollars' Facebook Profile
All content on this Personal Website (including text, photographs, audio files, and any other original works), unless otherwise noted on individual webpages, are available to anyone for re-use (reproduction, modification, derivation, distribution, etc.) for any non-commercial purpose under a Creative Commons License.