2017-12-21 21:49:53 +01:00
|
|
|
@echo off
|
|
|
|
|
|
2018-01-12 00:20:22 +01:00
|
|
|
REM Necessary for the InstallDir variable to work inside the MsBuild-finding loop below.
|
|
|
|
|
SETLOCAL ENABLEDELAYEDEXPANSION
|
|
|
|
|
|
2019-11-26 18:55:24 +01:00
|
|
|
for /f "usebackq tokens=1* delims=: " %%i in (`lib\vswhere\vswhere -latest -version "[15.0,17.0)" -requires Microsoft.Component.MSBuild`) do (
|
2017-12-21 21:49:53 +01:00
|
|
|
if /i "%%i"=="installationPath" (
|
|
|
|
|
set InstallDir=%%j
|
2018-01-12 00:20:22 +01:00
|
|
|
echo !InstallDir!
|
|
|
|
|
if exist "!InstallDir!\MSBuild\15.0\Bin\MSBuild.exe" (
|
2017-12-21 21:49:53 +01:00
|
|
|
echo "Using MSBuild from Visual Studio 2017"
|
2018-01-12 00:20:22 +01:00
|
|
|
set msbuild="!InstallDir!\MSBuild\15.0\Bin\MSBuild.exe"
|
2017-12-21 21:49:53 +01:00
|
|
|
goto build
|
|
|
|
|
)
|
2019-11-26 18:55:24 +01:00
|
|
|
if exist "!InstallDir!\MSBuild\Current\Bin\MSBuild.exe" (
|
|
|
|
|
echo "Using MSBuild from Visual Studio 2019"
|
|
|
|
|
set msbuild="!InstallDir!\MSBuild\Current\Bin\MSBuild.exe"
|
|
|
|
|
goto build
|
|
|
|
|
)
|
2017-12-21 21:49:53 +01:00
|
|
|
)
|
2017-04-24 11:13:42 -07:00
|
|
|
)
|
2015-12-13 23:46:19 +01:00
|
|
|
|
2017-01-03 13:42:27 -08:00
|
|
|
FOR %%b in (
|
2017-12-21 21:49:53 +01:00
|
|
|
"%VS140COMNTOOLS%\vsvars32.bat"
|
|
|
|
|
"%VS120COMNTOOLS%\vsvars32.bat"
|
|
|
|
|
"%VS110COMNTOOLS%\vsvars32.bat"
|
2017-01-03 13:42:27 -08:00
|
|
|
) do (
|
|
|
|
|
if exist %%b (
|
2017-12-21 21:49:53 +01:00
|
|
|
echo "Using MSBuild from %%b"
|
|
|
|
|
call %%b
|
|
|
|
|
set msbuild="msbuild"
|
|
|
|
|
goto build
|
2017-01-03 13:42:27 -08:00
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
2015-12-13 22:21:02 +01:00
|
|
|
echo "Unable to detect suitable environment. Build may not succeed."
|
|
|
|
|
|
|
|
|
|
:build
|
|
|
|
|
|
|
|
|
|
SET target=%1
|
|
|
|
|
SET project=%2
|
2016-03-25 15:06:39 +01:00
|
|
|
SET solution=%3
|
2015-12-13 22:21:02 +01:00
|
|
|
|
|
|
|
|
IF "%target%" == "" SET target=Build
|
2016-03-25 15:06:39 +01:00
|
|
|
IF "%project%" == "" SET project=Orchard.proj
|
|
|
|
|
IF "%solution%" == "" SET solution=src\Orchard.sln
|
2015-12-13 22:21:02 +01:00
|
|
|
|
2016-03-25 15:06:39 +01:00
|
|
|
lib\nuget\nuget.exe restore %solution%
|
2016-01-14 11:51:00 -08:00
|
|
|
|
2017-12-21 21:49:53 +01:00
|
|
|
%msbuild% /t:%target% %project% /p:Solution=%solution% /m
|
|
|
|
|
|
|
|
|
|
:end
|
2015-12-13 22:21:02 +01:00
|
|
|
|
2016-03-25 15:06:39 +01:00
|
|
|
pause
|