2012-03-11 21:17:56 +04:00
|
|
|
@echo off
|
|
|
|
pushd %~dp0
|
2013-11-09 04:05:08 +04:00
|
|
|
setlocal
|
2012-03-11 21:17:56 +04:00
|
|
|
|
|
|
|
if exist bin goto build
|
|
|
|
mkdir bin
|
|
|
|
|
|
|
|
:Build
|
2013-11-10 23:58:10 +04:00
|
|
|
|
2022-12-12 22:16:33 +03:00
|
|
|
REM Find the most recent 32bit MSBuild.exe on the system. Require v16.0 (installed with VS2019) or later.
|
|
|
|
REM Use `vswhere` for the search because it can find all VS installations.
|
2017-10-09 20:43:33 +03:00
|
|
|
set vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
|
|
if not exist %vswhere% (
|
2022-12-12 22:16:33 +03:00
|
|
|
set vswhere="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
|
2017-10-09 20:43:33 +03:00
|
|
|
)
|
|
|
|
if not exist %vswhere% (
|
|
|
|
REM vswhere.exe not in normal locations; check the Path.
|
|
|
|
for %%X in (vswhere.exe) do (
|
|
|
|
set vswhere="%%~$PATH:X"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if not exist %vswhere% (
|
|
|
|
echo Could not find vswhere.exe. Please run this from a Visual Studio developer prompt.
|
|
|
|
goto BuildFail
|
|
|
|
)
|
|
|
|
|
2022-12-12 22:16:33 +03:00
|
|
|
REM We're fine w/ any .NET SDK newer than 2.1.500 but also need a 2.1.x runtime. Microsoft.Net.Core.Component.SDK.2.1
|
|
|
|
REM actually checks for only the runtime these days.
|
2017-10-09 20:43:33 +03:00
|
|
|
set InstallDir=
|
2022-12-12 22:16:33 +03:00
|
|
|
for /f "usebackq tokens=*" %%i in (`%vswhere% -version 16 -latest -prerelease -products * ^
|
|
|
|
-requires Microsoft.Component.MSBuild ^
|
|
|
|
-requires Microsoft.NetCore.Component.SDK ^
|
|
|
|
-requires Microsoft.Net.Core.Component.SDK.2.1 ^
|
2022-11-20 02:32:34 +03:00
|
|
|
-property installationPath`) do (
|
2022-12-12 22:16:33 +03:00
|
|
|
set InstallDir="%%i"
|
2017-10-09 20:43:33 +03:00
|
|
|
)
|
2022-12-12 22:16:33 +03:00
|
|
|
|
|
|
|
if exist %InstallDir%\MSBuild\Current\Bin\MSBuild.exe (
|
|
|
|
set MSBuild=%InstallDir%\MSBuild\Current\Bin\MSBuild.exe
|
2017-10-09 20:43:33 +03:00
|
|
|
) else (
|
2022-12-12 22:16:33 +03:00
|
|
|
echo Could not find MSBuild.exe. Please install the VS2019 BuildTools component or a workload that includes it.
|
2017-10-09 20:43:33 +03:00
|
|
|
goto BuildFail
|
|
|
|
)
|
2013-11-09 04:05:08 +04:00
|
|
|
|
2022-12-12 22:16:33 +03:00
|
|
|
REM Configure NuGet operations to work w/in this repo i.e. do not pollute system packages folder.
|
|
|
|
REM Note this causes two copies of packages restored using packages.config to land in this folder e.g.
|
|
|
|
REM StyleCpy.5.0.0/ and stylecop/5.0.0/.
|
|
|
|
set "NUGET_PACKAGES=%CD%\packages"
|
|
|
|
|
2022-12-12 08:22:19 +03:00
|
|
|
REM Are we running in a local dev environment (not on CI)?
|
|
|
|
if DEFINED CI (set Desktop=false) else if DEFINED TEAMCITY_VERSION (set Desktop=false) else (set Desktop=true)
|
|
|
|
|
2012-03-11 21:17:56 +04:00
|
|
|
if "%1" == "" goto BuildDefaults
|
|
|
|
|
2022-12-12 08:22:19 +03:00
|
|
|
%MSBuild% Runtime.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=%Desktop% /v:M ^
|
2022-11-24 04:07:19 +03:00
|
|
|
/fl /fileLoggerParameters:LogFile=bin\msbuild.log;Verbosity=Normal /consoleLoggerParameters:Summary /t:%*
|
2012-10-12 01:59:26 +04:00
|
|
|
if %ERRORLEVEL% neq 0 goto BuildFail
|
2012-03-11 21:17:56 +04:00
|
|
|
goto BuildSuccess
|
|
|
|
|
|
|
|
:BuildDefaults
|
2022-12-12 08:22:19 +03:00
|
|
|
%MSBuild% Runtime.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=%Desktop% /v:M ^
|
2022-11-24 04:07:19 +03:00
|
|
|
/fl /fileLoggerParameters:LogFile=bin\msbuild.log;Verbosity=Normal /consoleLoggerParameters:Summary
|
2012-10-12 01:59:26 +04:00
|
|
|
if %ERRORLEVEL% neq 0 goto BuildFail
|
2012-03-11 21:17:56 +04:00
|
|
|
goto BuildSuccess
|
|
|
|
|
|
|
|
:BuildFail
|
|
|
|
echo.
|
|
|
|
echo *** BUILD FAILED ***
|
2017-10-09 20:43:33 +03:00
|
|
|
popd
|
|
|
|
endlocal
|
|
|
|
exit /B 999
|
2012-03-11 21:17:56 +04:00
|
|
|
|
|
|
|
:BuildSuccess
|
|
|
|
echo.
|
|
|
|
echo **** BUILD SUCCESSFUL ***
|
|
|
|
popd
|
2013-11-09 01:26:15 +04:00
|
|
|
endlocal
|
2017-10-09 20:43:33 +03:00
|
|
|
exit /B 0
|