Created
April 7, 2011 19:55
-
-
Save duncansmart/908576 to your computer and use it in GitHub Desktop.
A batch file that checks out a solution from SVN, builds it and packages it ready for MSDeploy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Required Config | |
set SVN_SOURCE=http://svnserver/svn/myrepo/mysolution | |
set WEB_PROJ_SUBDIR=Web | |
set PACKAGE_OUTPUT=C:\Builds\Packages | |
:: Required binaries | |
set SVN="%ProgramFiles(x86)%\CollabNet Subversion Client\svn.exe" | |
set MSBUILD="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" | |
:: Optional | |
set BUILDTEMP=%TEMP% | |
@echo ======== Getting SVN revision number ======= | |
for /f "tokens=1* delims=: " %%A in ('%SVN% info %SVN_SOURCE%') do @if "%%A"=="Revision" @set SVN_REV=%%B | |
if not defined SVN_REV echo Couldn't find SVN revision & exit /b 1 | |
@echo ======== Export r%SVN_REV% ======== | |
set WORK_DIR=%BUILDTEMP%\r%SVN_REV% | |
%SVN% -q -r %SVN_REV% export "%SVN_SOURCE%" "%WORK_DIR%" | |
@echo ======== Build and Package Web ======== | |
pushd "%WORK_DIR%\%WEB_PROJ_SUBDIR%" | |
%MSBUILD% /t:Package /nologo /v:minimal /p:Configuration=Release ^ | |
/p:PackageAsSingleFile=false ^ | |
/p:PackageArchiveRootDir="%PACKAGE_OUTPUT%\r%SVN_REV%" | |
if ERRORLEVEL 1 exit /b %ERRORLEVEL% | |
popd | |
rd /s /q %WORK_DIR% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment