一键用VS编译脚本

set MSBUILD_PATH="C:\Program Files (x86)\MSBuild\12.0\Bin\MsBuild.exe"
set ZIP_TOOL="C:\Program Files (x86)\WinRAR\WinRAR.exe"
set CURRENT_PATH=%cd%
set SERVER_PATH=%CURRENT_PATH%\ClientServer
set CODE_PATH=%CURRENT_PATH%\ServerCode

set SCENE_DIR=Scene
set TABLE_DIR=Tables
set RELEASE_DIR=Release

rd /s /q %CURRENT_PATH%\%SCENE_DIR%
rd /s /q %CURRENT_PATH%\%TABLE_DIR%
rd /s /q %CURRENT_PATH%\%RELEASE_DIR%


cd %SERVER_PATH%
svn cleanup
rem svn revert -R -q ./
svn up --force --accept tc
rem svn info|findstr "Revision*" >>%CURRENT_PATH%/%SVN_RES_FILE%
for /f "delims=" %%i in ('svn info^|findstr "Revision*" ') do set VERSION=%%i 

set RES_VERSION=%VERSION:~10,-1%
echo [%RES_VERSION%]

cd %CODE_PATH%
svn cleanup
svn revert -R -q ./
svn up --force --accept tc
rem svn info|findstr "Revision*" >>%CURRENT_PATH%/%SVN_CODE_FILE%
for /f "delims=" %%i in ('svn info^|findstr "Revision*" ') do set VERSION=%%i 
set CODE_VERSION=%VERSION:~10,-1%
echo [%CODE_VERSION%]

%MSBUILD_PATH% %CODE_PATH%/Servers.sln /t:Rebuild /p:Configuration=Release
if ERRORLEVEL 1 (PAUSE)


md %CURRENT_PATH%\%SCENE_DIR%
md %CURRENT_PATH%\%TABLE_DIR%
md %CURRENT_PATH%\%RELEASE_DIR%

copy %SERVER_PATH%\%SCENE_DIR%\*.* %CURRENT_PATH%\%SCENE_DIR%\
copy %SERVER_PATH%\%TABLE_DIR%\*.* %CURRENT_PATH%\%TABLE_DIR%\
copy %CODE_PATH%\bin\%RELEASE_DIR%\*.* %CURRENT_PATH%\%RELEASE_DIR%\

set h=%time:~0,2%
set h=%h: =0%
set TIME_STRING=%date:~0,4%%date:~5,2%%date:~8,2%%h%%time:~3,2%

set FILE_NAME=Server_s%CODE_VERSION%_r%RES_VERSION%_%TIME_STRING%.zip
cd %CURRENT_PATH%
%ZIP_TOOL% a %FILE_NAME% %SCENE_DIR%\ %TABLE_DIR%\ %RELEASE_DIR%\

:end
goto :eof

PAUSE

 

posted @ 2017-05-11 13:54  MrBlue  阅读(1072)  评论(0编辑  收藏  举报