forked from aspnet/AspNetWebHooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cmd
74 lines (63 loc) · 2.27 KB
/
build.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@echo off
setlocal
pushd %~dp0
if exist bin goto build
mkdir bin
:Build
REM Find the most recent 32bit MSBuild.exe on the system. Require v15.0 (installed with VS2017) or later.
REM Use `vswhere` for the search since %ProgramFiles(x86)%\msbuild\15.0\Bin\MSBuild.exe almost never exists.
set vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist %vswhere% (
set VsWhere="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
)
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
)
set InstallDir=
for /f "usebackq tokens=*" %%i in (`%vswhere% -latest -prerelease -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)
if exist "%InstallDir%\MSBuild\Current\Bin\MSBuild.exe" (
set MSBuild="%InstallDir%\MSBuild\Current\Bin\MSBuild.exe"
) else if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
set MSBuild="%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe"
) else (
echo Could not find MSBuild.exe. Please install the VS2017 BuildTools component or a workload that includes it.
goto BuildFail
)
REM Start Azure Storage Emulator
set StorageEmulator="%ProgramFiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe"
if not exist %StorageEmulator% (
echo Could not find AzureStorageEmulator.exe. Please install Azure SDK from http://azure.microsoft.com/en-us/downloads/
goto BuildFail
)
%StorageEmulator% stop 2> NUL
%StorageEmulator% clear 2> NUL
%StorageEmulator% start 2> NUL
if "%1" == "" goto BuildDefaults
%MSBuild% AspNetWebHooks.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal /t:%*
if %ERRORLEVEL% neq 0 goto BuildFail
goto BuildSuccess
:BuildDefaults
%MSBuild% AspNetWebHooks.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal
if %ERRORLEVEL% neq 0 goto BuildFail
goto BuildSuccess
:BuildFail
echo.
echo *** BUILD FAILED ***
popd
endlocal
exit /B 999
:BuildSuccess
echo.
echo **** BUILD SUCCESSFUL ***
popd
endlocal
exit /B 0