-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.cmd
48 lines (37 loc) · 1.36 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
@echo Off
pushd %~dp0
setlocal enabledelayedexpansion
set PROGRAMSROOT=%PROGRAMFILES%
if defined PROGRAMFILES(X86) set PROGRAMSROOT=%PROGRAMFILES(X86)%
:: Find the highest version of MSBuild installed on the system, or default to the version installed with .NET v4.0.
set MSBUILD_VERSION=0
for /D %%x in ("%PROGRAMSROOT%\MSBuild\*.0") do (
set "FN=%%~nx"
if !FN! gtr !MSBUILD_VERSION! set MSBUILD_VERSION=!FN!
)
set MSBUILD="%PROGRAMSROOT%\MSBuild\%MSBUILD_VERSION%.0\Bin\MSBuild.exe"
if not exist %MSBUILD% set MSBUILD="%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
set CACHED_NUGET=%LOCALAPPDATA%\NuGet\NuGet.exe
if exist %CACHED_NUGET% goto :CopyNuGet
echo Downloading latest version of NuGet.exe...
if not exist %LOCALAPPDATA%\NuGet @md %LOCALAPPDATA%\NuGet
@powershell -NoProfile -ExecutionPolicy Unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
:CopyNuGet
if exist .nuget\nuget.exe goto :Build
if not exist .nuget @md .nuget
@copy %CACHED_NUGET% .nuget\nuget.exe > nul
:Build
%MSBUILD% build\Build.proj /m /v:m %* /fl /flp:LogFile=msbuild.log;Verbosity=Detailed /nr:false /nologo
if %ERRORLEVEL% neq 0 goto :BuildFail
:BuildSuccess
echo.
echo *** BUILD SUCCEEDED ***
goto End
:BuildFail
echo.
echo *** BUILD FAILED ***
goto End
:End
echo.
popd
exit /B %ERRORLEVEL%