1 @echo off 2 pushd "%~dp0" 3 set msbuild="%windir%\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" /nologo /p:Configuration=Release;BuildProjectReferences=false 4 set pathBin=..\Output\Release 5 set path1=..\Src\Folder1 6 set path2=..\Src\Folder2 7 set buildlog=%~n0.log 8 9 set /p input="Start msbuild all (Release) ? [Y/n]: " 10 if "%input%"=="" goto :buildAll 11 if /i "%input%"=="Y" goto :buildAll 12 if /i "%input%"=="Yes" goto :buildAll 13 goto :end 14 15 :buildAll 16 if exist %buildlog% del %buildlog% 17 call :buildProj %path1% Proj1 18 call :buildProj %path1% Proj2 19 call :buildProj %path2% AnotherProj 20 echo. 21 set /p input="Start Foo.exe? [Y/n]: " 22 if "%input%"=="" goto :runFoo 23 if /i "%input%"=="Y" goto :runFoo 24 if /i "%input%"=="Yes" goto :runFoo 25 goto :end 26 27 :runFoo 28 call :run %pathBin% Foo.exe 29 goto :end 30 31 :run 32 cd /d %1 33 start "" %2 34 goto :eof 35 36 :buildProj 37 set desc=msbuild %2... 38 title %desc% 39 echo %desc% 40 echo ---------------------------------------->>%buildlog% 41 echo %desc%>>%buildlog% 42 echo ---------------------------------------->>%buildlog% 43 %msbuild% %1\%2\%2.csproj >>%buildlog% 44 if ERRORLEVEL 1 echo ERROR! 45 goto :eof 46 47 :end 48 popd
Build_Debug.bat
1 @echo off 2 pushd "%~dp0" 3 set msbuild="%windir%\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" /nologo /p:Configuration=Debug;BuildProjectReferences=false 4 set pathBin=..\Output\Debug 5 set path1=..\Src\Folder1 6 set path2=..\Src\Folder2 7 set buildlog=%~n0.log 8 9 set /p input="Start msbuild all (Debug) ? [Y/n]: " 10 if "%input%"=="" goto :buildAll 11 if /i "%input%"=="Y" goto :buildAll 12 if /i "%input%"=="Yes" goto :buildAll 13 goto :end 14 15 :buildAll 16 if exist %buildlog% del %buildlog% 17 call :buildProj %path1% Proj1 18 call :buildProj %path1% Proj2 19 call :buildProj %path2% AnotherProj 20 echo. 21 set /p input="Start Foo.exe? [Y/n]: " 22 if "%input%"=="" goto :runFoo 23 if /i "%input%"=="Y" goto :runFoo 24 if /i "%input%"=="Yes" goto :runFoo 25 goto :end 26 27 :runFoo 28 call :run %pathBin% Foo.exe 29 goto :end 30 31 :run 32 cd /d %1 33 start "" %2 34 goto :eof 35 36 :buildProj 37 set desc=msbuild %2... 38 title %desc% 39 echo %desc% 40 echo ---------------------------------------->>%buildlog% 41 echo %desc%>>%buildlog% 42 echo ---------------------------------------->>%buildlog% 43 %msbuild% %1\%2\%2.csproj >>%buildlog% 44 if ERRORLEVEL 1 echo ERROR! 45 goto :eof 46 47 :end 48 popd
Build_Clean.bat
1 @echo off 2 pushd "%~dp0" 3 set msbuild="%windir%\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" /nologo /t:clean 4 set sln=..\Src\Slns\Foo.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
时间: 2024-10-17 22:50:01