Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/Build.cmd @ 4873

Last change on this file since 4873 was 4873, checked in by abeham, 13 years ago

#1285

  • Updated build script to auto select the .sln file if only one was found
File size: 1.6 KB
Line 
1@ECHO OFF
2
3SET /A COUNT=0
4FOR /F "tokens=*" %%A IN ('dir /B *.sln') DO (
5  CALL :forloopbody "%%A")
6
7IF "%COUNT%"=="1" (
8  SET SELECTED=%SOLUTIONS.1%
9  ECHO Building %SOLUTIONS.1% as it is the only solution that was found ...
10  GOTO :config_platform_selection)
11
12ECHO Found the following solutions:
13FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO ECHO %%A = %%B
14ECHO.
15SET /P SOLUTIONINDEX=Which solution to build (type the number):
16
17SET SELECTED=""
18FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO (
19IF "%%A"=="%SOLUTIONINDEX%" SET SELECTED=%%B)
20
21IF %SELECTED%=="" GOTO :eof
22
23:config_platform_selection
24SET /P CONFIGURATION=Which configuration to build [Debug]:
25IF "%CONFIGURATION%"=="" SET CONFIGURATION=Debug
26SET /P PLATFORM=Which platform to build [Any CPU]:
27IF "%PLATFORM%"=="" SET PLATFORM=Any CPU
28
29REM First find the path to the msbuild.exe by performing a registry query
30FOR /F "tokens=1,3 delims=   " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0"') DO (
31  IF "%%A"=="MSBuildToolsPath" SET MSBUILDPATH=%%B)
32
33REM Then execute msbuild to clean and build the solution
34REM Disable that msbuild creates a cache file of the solution
35SET MSBuildUseNoSolutionCache=1
36REM Run msbuild to clean and then build
37%MSBUILDPATH%msbuild.exe %SELECTED% /target:Clean /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /nologo
38%MSBUILDPATH%msbuild.exe %SELECTED% /target:Build /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /nologo
39
40PAUSE
41
42GOTO :eof
43
44REM This workaround is necessary so that COUNT gets reevaluated
45:forloopbody
46SET /A COUNT+=1
47SET SOLUTIONS.%COUNT%=%1
48GOTO :eof
Note: See TracBrowser for help on using the repository browser.