[Winforms] Form fixes (#18427)
[mono-project.git] / msvc / run-msbuild.bat
blobaae07978a310d3b7a9660eb414e4bf2be80f86f7
1 :: Set up build environment and run execute msbuild with all supplied arguments.
3 :: Arguments:
4 :: -------------------------------------------------------
5 :: %1 Visual Studio target, build|clean, default build
6 :: %2 Host CPU architecture, x86_64|i686, default x86_64
7 :: %3 Visual Studio configuration, debug|release, default release
8 :: %4 Additional arguments passed to msbuild, needs to be quoted if multiple.
9 :: %5 Project to build.
10 :: -------------------------------------------------------
12 @echo off
13 setlocal
15 set BUILD_RESULT=1
17 :: Get path for current running script.
18 set RUN_MSBUILD_SCRIPT_PATH=%~dp0
20 :: Configure all known build arguments.
21 set VS_TARGET=build
22 if /i "%~1" == "clean" (
23     set VS_TARGET="clean"
25 shift
27 set VS_PLATFORM=x64
28 if /i "%~1" == "i686" (
29     set VS_PLATFORM="Win32"
31 if /i "%~1" == "win32" (
32     set VS_PLATFORM="Win32"
34 shift
36 set VS_CONFIGURATION=Release
37 if /i "%~1" == "debug" (
38     set VS_CONFIGURATION="Debug"
40 shift
42 set VS_TARGET_GC=sgen
43 if /i "%~1" == "boehm" (
44     set VS_TARGET_GC="boehm"
46 shift
48 set VS_ADDITIONAL_ARGUMENTS=
49 if not "%~1" == "" (
50     set VS_ADDITIONAL_ARGUMENTS=%~1
52 shift
54 set VS_BUILD_PROJ=mono.sln
55 if /i not "%~1" == "" (
56     set VS_BUILD_PROJ=%~1
59 if not exist %VS_BUILD_PROJ% (
60     set VS_BUILD_PROJ=%RUN_MSBUILD_SCRIPT_PATH%%VS_BUILD_PROJ%
63 :: Setup Windows environment.
64 call %RUN_MSBUILD_SCRIPT_PATH%setup-windows-env.bat
66 :: Setup VS msbuild environment.
67 call %RUN_MSBUILD_SCRIPT_PATH%setup-vs-msbuild-env.bat
69 if "%VS_ADDITIONAL_ARGUMENTS%" == "" (
70     set "VS_ADDITIONAL_ARGUMENTS=/p:PlatformToolset=%VS_DEFAULT_PLATFORM_TOOL_SET%"
73 set VS_BUILD_ARGS=/p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% /p:MONO_TARGET_GC=%VS_TARGET_GC% %VS_ADDITIONAL_ARGUMENTS% /t:%VS_TARGET% /m
74 call msbuild.exe %VS_BUILD_ARGS% "%VS_BUILD_PROJ%" && (
75     set BUILD_RESULT=0
76 ) || (
77     set BUILD_RESULT=1
78     if not %ERRORLEVEL% == 0 (
79         set BUILD_RESULT=%ERRORLEVEL%
80     )
83 exit /b %BUILD_RESULT%
85 @echo on