Build_Release.bat
1 @echo off 2 pushd "%~dp0" 3 set tag=Release 4 set PATH="C:Program Files (x86)MSBuild14.0Bin";"C:Program Files (x86)MSBuild14.0Binamd64";"%windir%Microsoft.NETFramework64v4.0.30319";%PATH% 5 set msbuild=msbuild.exe /p:Configuration=%tag%;BuildProjectReferences=false 6 set pathBin=..Output%tag% 7 set path1=..SrcFolder1 8 set path2=..SrcFolder2 9 set buildlog=%~n0.log 10 11 set input= 12 set /p input="Start msbuild all (%tag%) ? [Y/n]: " 13 if "%input%"=="" goto :buildAll 14 if /i "%input%"=="Y" goto :buildAll 15 if /i "%input%"=="Yes" goto :buildAll 16 goto :runPrompt 17 18 :buildAll 19 if exist %buildlog% del %buildlog% 20 call :buildProj %path1% Proj1 21 call :buildProj %path1% Proj2 22 call :buildProj %path2% AnotherProj 23 24 :runPrompt 25 echo. 26 set input= 27 set /p input="Start Foo.exe? [Y/n]: " 28 if "%input%"=="" goto :runFoo 29 if /i "%input%"=="Y" goto :runFoo 30 if /i "%input%"=="Yes" goto :runFoo 31 goto :end 32 33 :runFoo 34 call :run %pathBin% Foo.exe 35 goto :end 36 37 :run 38 cd /d %1 39 start "" %2 40 goto :eof 41 42 :buildProj 43 set desc=msbuild %2... 44 title %desc% 45 echo %desc% 46 echo ---------------------------------------->>%buildlog% 47 echo %desc%>>%buildlog% 48 echo ---------------------------------------->>%buildlog% 49 %msbuild% %1%2%2.csproj >>%buildlog% 50 if ERRORLEVEL 1 echo ERROR! 51 goto :eof 52 53 :end 54 popd
Build_Debug.bat
@echo off pushd "%~dp0" set tag=Debug set PATH="C:Program Files (x86)MSBuild14.0Bin";"C:Program Files (x86)MSBuild14.0Binamd64";"%windir%Microsoft.NETFramework64v4.0.30319";%PATH% set msbuild=msbuild.exe /p:Configuration=%tag%;BuildProjectReferences=false set pathBin=..Output%tag% set path1=..SrcFolder1 set path2=..SrcFolder2 set buildlog=%~n0.log set input= set /p input="Start msbuild all (%tag%) ? [Y/n]: " if "%input%"=="" goto :buildAll if /i "%input%"=="Y" goto :buildAll if /i "%input%"=="Yes" goto :buildAll goto :runPrompt :buildAll if exist %buildlog% del %buildlog% call :buildProj %path1% Proj1 call :buildProj %path1% Proj2 call :buildProj %path2% AnotherProj :runPrompt echo. set input= set /p input="Start Foo.exe? [Y/n]: " if "%input%"=="" goto :runFoo if /i "%input%"=="Y" goto :runFoo if /i "%input%"=="Yes" goto :runFoo goto :end :runFoo call :run %pathBin% Foo.exe goto :end :run cd /d %1 start "" %2 goto :eof :buildProj set desc=msbuild %2... title %desc% echo %desc% echo ---------------------------------------->>%buildlog% echo %desc%>>%buildlog% echo ---------------------------------------->>%buildlog% %msbuild% %1%2%2.csproj >>%buildlog% if ERRORLEVEL 1 echo ERROR! goto :eof :end popd
Build_Clean.bat
1 @echo off 2 pushd "%~dp0" 3 set msbuild="%windir%Microsoft.NETFramework64v4.0.30319msbuild.exe" /nologo /t:clean 4 set sln=..SrcSlnsFoo.sln 5 set /p input="Start msbuild clean? [Y/n]: " 6 if "%input%"=="" goto :clean 7 if /i "%input%"=="Y" goto :clean 8 if /i "%input%"=="Yes" goto :clean 9 goto :end 10 :clean 11 %msbuild% %sln% 12 IF %ERRORLEVEL% NEQ 0 PAUSE 13 :end 14 popd