Skip to content

Commit

Permalink
build.cmd uses either MSBuild 12 or MSBuild 14 and works on x64 & x86
Browse files Browse the repository at this point in the history
Previously our repositories would build in either a Dev12 or a Dev14
Developer Command Prompt, but only if Dev12 (for MSBuild 12) was
on the box due to a hard-coded path to MSBuild 12.  This change
will use MSBuild 14 if MSBuild 12 is not available.  Also previously
this would look for MSBuild in the WOW Program Files path, this change
causes us to also look in the normal Program Files path for x86
Windows.
  • Loading branch information
Matt Cohn committed Nov 12, 2014
1 parent 2de7dce commit c8d365b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
@echo off
setlocal

:: Note: We've disabled node reuse because it causes file locking issues.
:: The issue is that we extend the build with our own targets which
:: means that that rebuilding cannot successully delete the task
:: assembly.
:: assembly.

:: Check prerequisites
set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/corefx/blob/master/docs/Developers.md for build instructions. && goto :eof

:: Log build command line
set buildprefix=echo
set buildpostfix=^> "%~dp0msbuild.log"
set _buildprefix=echo
set _buildpostfix=^> "%~dp0msbuild.log"
call :build %*

:: Build
set buildprefix=
set buildpostfix=
set _buildprefix=
set _buildpostfix=
call :build %*

goto :eof

:build
%buildprefix% "%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe" "%~dp0build.proj" /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=diag;LogFile="%~dp0msbuild.log";Append %* %buildpostfix%
goto :eof
%_buildprefix% %_msbuildexe% "%~dp0build.proj" /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=diag;LogFile="%~dp0msbuild.log";Append %* %_buildpostfix%
goto :eof

0 comments on commit c8d365b

Please sign in to comment.