forked from dotnet/versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cmd
38 lines (31 loc) · 1.52 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
@echo off
setlocal
set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist %_VSWHERE% (
for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
)
if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS150COMNTOOLS%
if not exist "%_VSCOMNTOOLS%" (
echo Error: Visual Studio 2017+ required.
echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
exit /b 1
)
set nuGetVersion=v3.4.4
set cachedNuGetDir=%LocalAppData%\NuGet\%nuGetVersion%
set cachedNuGet=%cachedNuGetDir%\NuGet.exe
set logFile="%~dp0build.log"
set solutionPath="%~dp0Microsoft.DotNet.Maestro.sln"
set buildArgs=/nologo /maxcpucount /nodeReuse:false /v:minimal /clp:Summary /flp:Verbosity=detailed;LogFile=%logFile%;Append %*
REM Add msbuild to the path for the current process.
call "%_VSCOMNTOOLS%\VsDevCmd.bat"
if not exist %cachedNuGet% (
echo Downloading NuGet.exe %nuGetVersion%.
if not exist %cachedNuGetDir% mkdir %cachedNuGetDir%
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%nuGetVersion%/NuGet.exe' -OutFile '%cachedNuGet%'"
)
echo Restoring packages for %solutionPath%
%cachedNuGet% restore %solutionPath%
echo Building %solutionPath%
echo msbuild %solutionPath% %buildArgs%> %logFile%
echo.>> %logFile%
msbuild %solutionPath% %buildArgs%