1 @if not defined __echo @echo off
2 setlocal EnableDelayedExpansion EnableExtensions
4 set __ThisScriptShort=%0
5 set __ThisScriptFull="%~f0"
6 set __ThisScriptPath="%~dp0"
8 :: Note that the msbuild project files (specifically, dir.proj) will use the following variables, if set:
9 :: __BuildArch -- default: x64
10 :: __BuildType -- default: Debug
11 :: __BuildOS -- default: Windows_NT
12 :: __ProjectDir -- default: directory of the dir.props file
13 :: __SourceDir -- default: %__ProjectDir%\src\
14 :: __PackagesDir -- default: %__ProjectDir%\packages\
15 :: __RootBinDir -- default: %__ProjectDir%\bin\
16 :: __BinDir -- default: %__RootBinDir%\%__BuildOS%.%__BuildArch.%__BuildType%\
18 :: __PackagesBinDir -- default: %__BinDir%\.nuget
19 :: __TestWorkingDir -- default: %__RootBinDir%\tests\%__BuildOS%.%__BuildArch.%__BuildType%\
21 :: Thus, these variables are not simply internal to this script!
23 :: Set the default arguments for build
26 set __BuildOS=Windows_NT
28 :: Default to highest Visual Studio version available
29 set __VSVersion=vs2015
31 if defined VS140COMNTOOLS set __VSVersion=vs2015
33 :: Define a prefix for most output progress messages that come from this script. That makes
34 :: it easier to see where these are coming from. Note that there is a trailing space here.
35 set __MsgPrefix=BUILD:
37 :: Set the various build properties here so that CMake and MSBuild can pick them up
38 set "__ProjectDir=%~dp0"
39 :: remove trailing slash
40 if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
41 set "__ProjectFilesDir=%__ProjectDir%"
42 set "__SourceDir=%__ProjectDir%\src"
43 set "__PackagesDir=%__ProjectDir%\packages"
44 set "__RootBinDir=%__ProjectDir%\bin"
45 set "__LogsDir=%__RootBinDir%\Logs"
51 set __SkipCoreLibBuild=
52 set __SkipNativeBuild=
54 set __BuildSequential=
56 set __SkipBuildPackages=
57 set __msbuildCleanBuildArgs=
58 set __msbuildExtraArgs=
60 set __OfficialBuildIdArg=
67 set __BuildArchArm64=0
69 set __BuildTypeDebug=0
70 set __BuildTypeChecked=0
71 set __BuildTypeRelease=0
73 set __BuildJit32="-DBUILD_JIT32=0"
75 REM __PassThroughArgs is a set of things that will be passed through to nested calls to build.cmd
77 set __PassThroughArgs=
80 if "%1" == "" goto ArgsDone
82 if /i "%1" == "/?" goto Usage
83 if /i "%1" == "-?" goto Usage
84 if /i "%1" == "/h" goto Usage
85 if /i "%1" == "-h" goto Usage
86 if /i "%1" == "/help" goto Usage
87 if /i "%1" == "-help" goto Usage
89 if /i "%1" == "all" (set __BuildAll=1&shift&goto Arg_Loop)
91 if /i "%1" == "x64" (set __BuildArchX64=1&shift&goto Arg_Loop)
92 if /i "%1" == "x86" (set __BuildArchX86=1&shift&goto Arg_Loop)
93 if /i "%1" == "arm" (set __BuildArchArm=1&shift&goto Arg_Loop)
94 if /i "%1" == "arm64" (set __BuildArchArm64=1&shift&goto Arg_Loop)
96 if /i "%1" == "debug" (set __BuildTypeDebug=1&shift&goto Arg_Loop)
97 if /i "%1" == "checked" (set __BuildTypeChecked=1&shift&goto Arg_Loop)
98 if /i "%1" == "release" (set __BuildTypeRelease=1&shift&goto Arg_Loop)
100 REM All arguments after this point will be passed through directly to build.cmd on nested invocations
101 REM using the "all" argument, and must be added to the __PassThroughArgs variable.
102 set __PassThroughArgs=%__PassThroughArgs% %1
104 if /i "%1" == "clean" (set __CleanBuild=1&shift&goto Arg_Loop)
106 if /i "%1" == "freebsdmscorlib" (set __CoreLibOnly=1&set __BuildOS=FreeBSD&shift&goto Arg_Loop)
107 if /i "%1" == "linuxmscorlib" (set __CoreLibOnly=1&set __BuildOS=Linux&shift&goto Arg_Loop)
108 if /i "%1" == "netbsdmscorlib" (set __CoreLibOnly=1&set __BuildOS=NetBSD&shift&goto Arg_Loop)
109 if /i "%1" == "osxmscorlib" (set __CoreLibOnly=1&set __BuildOS=OSX&shift&goto Arg_Loop)
110 if /i "%1" == "windowsmscorlib" (set __CoreLibOnly=1&set __BuildOS=Windows_NT&shift&goto Arg_Loop)
112 if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop)
113 if /i "%1" == "configureonly" (set __ConfigureOnly=1&set __SkipCoreLibBuild=1&set __SkipTestBuild=1&shift&goto Arg_Loop)
114 if /i "%1" == "skipconfigure" (set __SkipConfigure=1&shift&goto Arg_Loop)
115 if /i "%1" == "skipmscorlib" (set __SkipCoreLibBuild=1&shift&goto Arg_Loop)
116 if /i "%1" == "skipnative" (set __SkipNativeBuild=1&shift&goto Arg_Loop)
117 if /i "%1" == "skiptests" (set __SkipTestBuild=1&shift&goto Arg_Loop)
118 if /i "%1" == "skiprestore" (set __SkipRestore=1&shift&goto Arg_Loop)
119 if /i "%1" == "skipbuildpackages" (set __SkipBuildPackages=1&shift&goto Arg_Loop)
120 if /i "%1" == "sequential" (set __BuildSequential=1&shift&goto Arg_Loop)
121 if /i "%1" == "disableoss" (set __SignTypeReal="/p:SignType=real"&shift&goto Arg_Loop)
122 if /i "%1" == "priority" (set __TestPriority=%2&set __PassThroughArgs=%__PassThroughArgs% %2&shift&shift&goto Arg_Loop)
123 if /i "%1" == "gcstresslevel" (set __GCStressLevel=%2&set __PassThroughArgs=%__PassThroughArgs% %2&shift&shift&goto Arg_Loop)
124 if /i "%1" == "buildjit32" (set __BuildJit32="-DBUILD_JIT32=1"&shift&goto Arg_Loop)
126 @REM For backwards compatibility, continue accepting "skiptestbuild", which was the original name of the option.
127 if /i "%1" == "skiptestbuild" (set __SkipTestBuild=1&shift&goto Arg_Loop)
129 @REM It was initially /toolset_dir. Not sure why, since it doesn't match the other usage.
130 if /i "%1" == "/toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&shift&shift&goto Arg_Loop)
131 if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&shift&shift&goto Arg_Loop)
133 if /i not "%1" == "msbuildargs" goto SkipMsbuildArgs
134 :: All the rest of the args will be collected and passed directly to msbuild.
137 if "%1"=="" goto ArgsDone
138 if /i [%1] == [/p:OfficialBuildId] (
140 echo Error: /p:OfficialBuildId arg should have a value
143 set __OfficialBuildIdArg=/p:OfficialBuildId=%2
145 goto CollectMsbuildArgs
147 set __msbuildExtraArgs=%__msbuildExtraArgs% %1
148 set __PassThroughArgs=%__PassThroughArgs% %1
149 goto CollectMsbuildArgs
152 echo Invalid command-line argument: %1
157 if defined __ConfigureOnly if defined __SkipConfigure (
158 echo "Error: option 'configureonly' is incompatible with 'skipconfigure'"
162 if defined __SkipCoreLibBuild if defined __CoreLibOnly (
163 echo Error: option 'skipmscorlib' is incompatible with 'freebsdmscorlib', 'linuxmscorlib', 'netbsdmscorlib', 'osxmscorlib' and 'windowsmscorlib'.
167 if defined __BuildAll goto BuildAll
169 set /A __TotalSpecifiedBuildArch=__BuildArchX64 + __BuildArchX86 + __BuildArchArm + __BuildArchArm64
170 if %__TotalSpecifiedBuildArch% GTR 1 (
171 echo Error: more than one build architecture specified, but "all" not specified.
175 if %__BuildArchX64%==1 set __BuildArch=x64
176 if %__BuildArchX86%==1 set __BuildArch=x86
177 if %__BuildArchArm%==1 set __BuildArch=arm
178 if %__BuildArchArm64%==1 (
179 set __BuildArch=arm64
183 set /A __TotalSpecifiedBuildType=__BuildTypeDebug + __BuildTypeChecked + __BuildTypeRelease
184 if %__TotalSpecifiedBuildType% GTR 1 (
185 echo Error: more than one build type specified, but "all" not specified.
189 if %__BuildTypeDebug%==1 set __BuildType=Debug
190 if %__BuildTypeChecked%==1 set __BuildType=Checked
191 if %__BuildTypeRelease%==1 set __BuildType=Release
193 echo %__MsgPrefix%Commencing CoreCLR Repo build
195 :: Set the remaining variables based upon the determined build configuration
196 set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
197 set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
198 set "__PackagesBinDir=%__BinDir%\.nuget"
199 set "__TestRootDir=%__RootBinDir%\tests"
200 set "__TestBinDir=%__TestRootDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
201 set "__TestIntermediatesDir=%__RootBinDir%\tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
202 set "__CrossComponentBinDir=%__BinDir%"
203 if defined __CrossArch set __CrossComponentBinDir=%__CrossComponentBinDir%\%__CrossArch%
205 :: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
206 set "__CMakeBinDir=%__BinDir%"
207 set "__CMakeBinDir=%__CMakeBinDir:\=/%"
209 :: Configure environment if we are doing a clean build.
210 if not defined __CleanBuild goto SkipCleanBuild
211 echo %__MsgPrefix%Doing a clean build
213 :: MSBuild projects would need a rebuild
214 set __msbuildCleanBuildArgs=/t:rebuild
216 :: Cleanup the previous output for the selected configuration
217 if exist "%__BinDir%" rd /s /q "%__BinDir%"
218 if exist "%__IntermediatesDir%" rd /s /q "%__IntermediatesDir%"
219 if exist "%__TestBinDir%" rd /s /q "%__TestBinDir%"
220 if exist "%__TestIntermediatesDir%" rd /s /q "%__TestIntermediatesDir%"
221 if exist "%__LogsDir%" del /f /q "%__LogsDir%\*_%__BuildOS%__%__BuildArch%__%__BuildType%.*"
222 if exist "%__ProjectDir%\Tools" rd /s /q "%__ProjectDir%\Tools"
226 if not exist "%__BinDir%" md "%__BinDir%"
227 if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
228 if not exist "%__LogsDir%" md "%__LogsDir%"
230 :: CMake isn't a requirement when building CoreLib only
231 if defined __CoreLibOnly goto CheckVS
233 echo %__MsgPrefix%Checking prerequisites
235 :: Validate that PowerShell is accessibile.
236 for %%X in (powershell.exe) do (set __PSDir=%%~$PATH:X)
237 if not defined __PSDir goto :NoPS
239 :: Validate Powershell version
240 set "PS_VERSION_LOG=%__LogsDir%\ps-version.log"
241 powershell -NoProfile -ExecutionPolicy unrestricted -Command "$PSVersionTable.PSVersion.Major" > %PS_VERSION_LOG%
242 set /P PS_VERSION=< %PS_VERSION_LOG%
243 if %PS_VERSION% LEQ 2 (
247 :: Eval the output from probe-win1.ps1
248 for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a
252 set __VSProductVersion=
253 if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140
255 :: Check presence of VS
256 if not defined VS%__VSProductVersion%COMNTOOLS goto NoVS
258 set __VSToolsRoot=!VS%__VSProductVersion%COMNTOOLS!
259 if %__VSToolsRoot:~-1%==\ set "__VSToolsRoot=%__VSToolsRoot:~0,-1%"
261 :: Does VS really exist?
262 if not exist "%__VSToolsRoot%\..\IDE\devenv.exe" goto NoVS
263 if not exist "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" goto NoVS
264 if not exist "%__VSToolsRoot%\VsDevCmd.bat" goto NoVS
267 set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
269 if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
270 if not exist %_msbuildexe% echo %__MsgPrefix%Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. && exit /b 1
272 :: Note: We've disabled node reuse because it causes file locking issues.
273 :: The issue is that we extend the build with our own targets which
274 :: means that that rebuilding cannot successfully delete the task
276 set __msbuildCommonArgs=/nologo /nodeReuse:false %__msbuildCleanBuildArgs% %__msbuildExtraArgs%
278 if not defined __BuildSequential (
279 set __msbuildCommonArgs=%__msbuildCommonArgs% /maxcpucount
281 if defined __SkipRestore (
282 set __msbuildCommonArgs=%__msbuildCommonArgs% /p:RestoreDuringBuild=false
286 REM =========================================================================================
288 REM === Restore Build Tools
290 REM =========================================================================================
291 call %__ThisScriptPath%init-tools.cmd
293 echo ERROR: Could not restore build tools.
297 REM =========================================================================================
299 REM === Start the build steps
301 REM =========================================================================================
303 :: Generate _version.h
304 if exist "%__RootBinDir%\obj\_version.h" del "%__RootBinDir%\obj\_version.h"
305 %_msbuildexe% "%__ProjectFilesDir%\build.proj" /t:GenerateVersionHeader /v:minimal /p:NativeVersionHeaderFile="%__RootBinDir%\obj\_version.h" /p:GenerateVersionHeader=true %__OfficialBuildIdArg%
306 if defined __CoreLibOnly goto PerformCoreLibBuild
308 if defined __SkipNativeBuild (
309 echo %__MsgPrefix%Skipping native components build
313 echo %__MsgPrefix%Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType%
315 REM Use setlocal to restrict environment changes form vcvarsall.bat and more to just this native components build section.
316 setlocal EnableDelayedExpansion EnableExtensions
318 if /i "%__BuildArch%" == "arm64" (
319 rem arm64 builds currently use private toolset which has not been released yet
320 REM TODO, remove once the toolset is open.
326 :: Set the environment for the native build
327 set __VCBuildArch=x86_amd64
328 if /i "%__BuildArch%" == "x86" (set __VCBuildArch=x86)
329 echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
330 call "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
331 @if defined __echo @echo on
333 if not defined VSINSTALLDIR (
334 echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined.
337 if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA
341 if defined __SkipConfigure goto SkipConfigure
343 echo %__MsgPrefix%Regenerating the Visual Studio solution
345 pushd "%__IntermediatesDir%"
346 call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildArch% %__BuildJit32%
347 @if defined __echo @echo on
352 if not exist "%__IntermediatesDir%\install.vcxproj" (
353 echo %__MsgPrefix%Error: failed to generate native component build project!
357 REM =========================================================================================
359 REM === Build the CLR VM
361 REM =========================================================================================
363 if defined __ConfigureOnly goto SkipNativeBuild
365 echo %__MsgPrefix%Invoking msbuild
367 set "__BuildLog=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
368 set "__BuildWrn=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn"
369 set "__BuildErr=%__LogsDir%\CoreCLR_%__BuildOS%__%__BuildArch%__%__BuildType%.err"
370 set __msbuildLogArgs=^
371 /fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%" ^
372 /fileloggerparameters1:WarningsOnly;LogFile="%__BuildWrn%" ^
373 /fileloggerparameters2:ErrorsOnly;LogFile="%__BuildErr%" ^
374 /consoleloggerparameters:Summary ^
377 set __msbuildArgs="%__IntermediatesDir%\install.vcxproj" %__msbuildCommonArgs% %__msbuildLogArgs% /p:Configuration=%__BuildType%
379 if /i "%__BuildArch%" == "arm64" (
380 REM TODO, remove once we have msbuild support for this platform.
381 set __msbuildArgs=%__msbuildArgs% /p:UseEnv=true
383 set __msbuildArgs=%__msbuildArgs% /p:Platform=%__BuildArch%
386 %_msbuildexe% %__msbuildArgs%
388 echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details:
395 REM endlocal to rid us of environment changes from vcvarsall.bat
400 REM =========================================================================================
402 REM === CoreLib and NuGet package build section.
404 REM =========================================================================================
408 REM setlocal to prepare for vsdevcmd.bat
409 setlocal EnableDelayedExpansion EnableExtensions
411 rem Explicitly set Platform causes conflicts in CoreLib project files. Clear it to allow building from VS x64 Native Tools Command Prompt
414 :: Set the environment for the managed build
415 echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat"
416 call "%__VSToolsRoot%\VsDevCmd.bat"
418 if defined __SkipCoreLibBuild (
419 echo %__MsgPrefix%Skipping System.Private.CoreLib build
420 goto SkipCoreLibBuild
423 echo %__MsgPrefix%Commencing build of System.Private.CoreLib for %__BuildOS%.%__BuildArch%.%__BuildType%
425 set "__BuildLog=%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
426 set "__BuildWrn=%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn"
427 set "__BuildErr=%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.err"
428 set __msbuildLogArgs=^
429 /fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%" ^
430 /fileloggerparameters1:WarningsOnly;LogFile="%__BuildWrn%" ^
431 /fileloggerparameters2:ErrorsOnly;LogFile="%__BuildErr%" ^
432 /consoleloggerparameters:Summary ^
435 set __msbuildArgs="%__ProjectFilesDir%\build.proj" %__msbuildCommonArgs% %__msbuildLogArgs% %__SignTypeReal%
437 set __BuildNugetPackage=true
438 if defined __CoreLibOnly set __BuildNugetPackage=false
439 if /i "%__BuildArch%" =="arm64" set __BuildNugetPackage=false
440 if %__BuildNugetPackage%==false set __msbuildArgs=%__msbuildArgs% /p:BuildNugetPackage=false
442 %_msbuildexe% %__msbuildArgs%
444 echo %__MsgPrefix%Error: System.Private.CoreLib build failed. Refer to the build log files for details:
451 if defined __CoreLibOnly (
452 echo %__MsgPrefix%System.Private.CoreLib successfully built.
456 echo %__MsgPrefix%Generating native image of System.Private.CoreLib for %__BuildOS%.%__BuildArch%.%__BuildType%
458 set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenCoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
459 set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe"
460 "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1
461 if NOT errorlevel 0 (
462 echo %__MsgPrefix%Error: CrossGen System.Private.CoreLib build failed. Refer to the build log file for details:
463 echo %__CrossGenCoreLibLog%
467 echo %__MsgPrefix%Generating native image of MScorlib facade for %__BuildOS%.%__BuildArch%.%__BuildType%
469 set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenMSCoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
470 set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe"
471 "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\mscorlib.ni.dll" "%__BinDir%\mscorlib.dll" > "%__CrossGenCoreLibLog%" 2>&1
472 if NOT errorlevel 0 (
473 echo %__MsgPrefix%Error: CrossGen mscorlib facade build failed. Refer to the build log file for details:
474 echo %__CrossGenCoreLibLog%
481 if /i "%__BuildArch%" =="arm64" goto :SkipNuget
482 if /i "%__SkipBuildPackages%" == 1 goto :SkipNuget
484 set "__BuildLog=%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
485 set "__BuildWrn=%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn"
486 set "__BuildErr=%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.err"
487 set __msbuildLogArgs=^
488 /fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%" ^
489 /fileloggerparameters1:WarningsOnly;LogFile="%__BuildWrn%" ^
490 /fileloggerparameters2:ErrorsOnly;LogFile="%__BuildErr%" ^
491 /consoleloggerparameters:Summary ^
494 if not defined __SkipCoreLibBuild (
495 set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.Runtime.CoreClr\Microsoft.NETCore.Runtime.CoreCLR.builds" /p:Platform=%__BuildArch%
496 %_msbuildexe% !__msbuildArgs! %__msbuildLogArgs%
498 echo %__MsgPrefix%Error: Nuget package generation failed build failed. Refer to the build log files for details:
506 if not defined __SkipNativeBuild (
507 set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.Jit\Microsoft.NETCore.Jit.builds" /p:Platform=%__BuildArch%
508 %_msbuildexe% !__msbuildArgs! %__msbuildLogArgs%
510 echo %__MsgPrefix%Error: Nuget package generation failed build failed. Refer to the build log files for details:
518 rem Build the ILAsm package
519 set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.ILAsm\Microsoft.NETCore.ILAsm.builds" /p:Platform=%__BuildArch%
520 %_msbuildexe% %__msbuildArgs% %__msbuildLogArgs%
522 echo %__MsgPrefix%Error: ILAsm Nuget package generation failed build failed. Refer to the build log files for details:
529 rem Build the ILDAsm package
530 set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.ILDAsm\Microsoft.NETCore.ILDAsm.builds" /p:Platform=%__BuildArch%
531 %_msbuildexe% %__msbuildArgs% %__msbuildLogArgs%
533 echo %__MsgPrefix%Error: ILDAsm Nuget package generation failed build failed. Refer to the build log files for details:
542 REM endlocal to rid us of environment changes from vsdevenv.bat
545 REM =========================================================================================
547 REM === Test build section
549 REM =========================================================================================
551 if defined __SkipTestBuild (
552 echo %__MsgPrefix%Skipping test build
556 echo %__MsgPrefix%Commencing build of tests for %__BuildOS%.%__BuildArch%.%__BuildType%
558 REM Construct the arguments to pass to the test build script.
560 set __BuildtestArgs=%__BuildArch% %__BuildType% %__VSVersion%
562 if defined __CleanBuild (
563 set "__BuildtestArgs=%__BuildtestArgs% clean"
566 if defined __BuildSequential (
567 set "__BuildtestArgs=%__BuildtestArgs% sequential"
570 if defined __TestPriority (
571 set "__BuildtestArgs=%__BuildtestArgs% Priority %__TestPriority%"
574 if %__GCStressLevel% GTR 0 (
575 set "__BuildtestArgs=%__BuildtestArgs% gcstresslevel %__GCStressLevel%"
578 rem arm64 builds currently use private toolset which has not been released yet
579 REM TODO, remove once the toolset is open.
580 if /i "%__BuildArch%" == "arm64" call :PrivateToolSet
582 call %__ProjectDir%\tests\buildtest.cmd %__BuildtestArgs%
585 REM buildtest.cmd has already emitted an error message and mentioned the build log file to examine.
591 REM =========================================================================================
593 REM === All builds complete!
595 REM =========================================================================================
597 echo %__MsgPrefix%Repo successfully built.
598 echo %__MsgPrefix%Product binaries are available at !__BinDir!
599 if not defined __SkipTestBuild (
600 echo %__MsgPrefix%Test binaries are available at !__TestBinDir!
604 REM =========================================================================================
606 REM === Handle the "all" case.
608 REM =========================================================================================
614 set /A __TotalSpecifiedBuildArch=__BuildArchX64 + __BuildArchX86 + __BuildArchArm + __BuildArchArm64
615 if %__TotalSpecifiedBuildArch% EQU 0 (
616 REM Nothing specified means we want to build all architectures.
617 set __BuildArchList=x64 x86 arm arm64
620 REM Otherwise, add all the specified architectures to the list.
622 if %__BuildArchX64%==1 set __BuildArchList=%__BuildArchList% x64
623 if %__BuildArchX86%==1 set __BuildArchList=%__BuildArchList% x86
624 if %__BuildArchArm%==1 set __BuildArchList=%__BuildArchList% arm
625 if %__BuildArchArm64%==1 set __BuildArchList=%__BuildArchList% arm64
629 set /A __TotalSpecifiedBuildType=__BuildTypeDebug + __BuildTypeChecked + __BuildTypeRelease
630 if %__TotalSpecifiedBuildType% EQU 0 (
631 REM Nothing specified means we want to build all build types.
632 set __BuildTypeList=Debug Checked Release
635 if %__BuildTypeDebug%==1 set __BuildTypeList=%__BuildTypeList% Debug
636 if %__BuildTypeChecked%==1 set __BuildTypeList=%__BuildTypeList% Checked
637 if %__BuildTypeRelease%==1 set __BuildTypeList=%__BuildTypeList% Release
639 REM Create a temporary file to collect build results. We always build all flavors specified, and
640 REM report a summary of the results at the end.
642 set __AllBuildSuccess=true
643 set __BuildResultFile=%TEMP%\build-all-summary-%RANDOM%.txt
644 if exist %__BuildResultFile% del /f /q %__BuildResultFile%
646 for %%i in (%__BuildArchList%) do (
647 for %%j in (%__BuildTypeList%) do (
648 call :BuildOne %%i %%j
652 if %__AllBuildSuccess%==true (
653 echo %__MsgPrefix%All builds succeeded!
656 echo %__MsgPrefix%Builds failed:
657 type %__BuildResultFile%
658 del /f /q %__BuildResultFile%
662 REM This code is unreachable, but leaving it nonetheless, just in case things change.
668 set __NextCmd=call %__ThisScriptFull% %__BuildArch% %__BuildType% %__PassThroughArgs%
669 echo %__MsgPrefix%Invoking: %__NextCmd%
672 echo %__MsgPrefix% %__BuildArch% %__BuildType% %__PassThroughArgs% >> %__BuildResultFile%
673 set __AllBuildSuccess=false
677 REM =========================================================================================
679 REM === Helper routines
681 REM =========================================================================================
685 echo Build the CoreCLR repo.
688 echo %__ThisScriptShort% [option1] [option2] ...
690 echo %__ThisScriptShort% all [option1] [option2] ...
692 echo All arguments are optional. The options are:
694 echo./? -? /h -h /help -help: view this message.
695 echo Build architecture: one of x64, x86, arm, arm64 ^(default: x64^).
696 echo Build type: one of Debug, Checked, Release ^(default: Debug^).
697 echo Visual Studio version: ^(default: VS2015^).
698 echo clean: force a clean build ^(default is to perform an incremental build^).
699 echo msbuildargs ... : all arguments following this tag will be passed directly to msbuild.
700 echo mscorlib version: one of freebsdmscorlib, linuxmscorlib, netbsdmscorlib, osxmscorlib,
701 echo or windowsmscorlib. If one of these is passed, only System.Private.CoreLib is built,
702 echo for the specified platform ^(FreeBSD, Linux, NetBSD, OS X or Windows,
704 echo priority ^<N^> : specify a set of test that will be built and run, with priority N.
705 echo gcstresslevel ^<N^> : specify the GCStress level the tests should run under.
706 echo sequential: force a non-parallel build ^(default is to build in parallel
707 echo using all processors^).
708 echo configureonly: skip all builds; only run CMake ^(default: CMake and builds are run^)
709 echo skipconfigure: skip CMake ^(default: CMake is run^)
710 echo skipmscorlib: skip building System.Private.CoreLib ^(default: System.Private.CoreLib is built^).
711 echo skipnative: skip building native components ^(default: native components are built^).
712 echo skiptests: skip building tests ^(default: tests are built^).
713 echo skiprestore: skip restoring packages ^(default: packages are restored during build^).
714 echo skipbuildpackages: skip building nuget packages ^(default: packages are built^).
715 echo disableoss: Disable Open Source Signing for System.Private.CoreLib.
716 echo toolset_dir ^<dir^> : set the toolset directory -- Arm64 use only. Required for Arm64 builds.
718 echo If "all" is specified, then all build architectures and types are built. If, in addition,
719 echo one or more build architectures or types is specified, then only those build architectures
720 echo and types are built.
724 echo -- builds all architectures, and all build types per architecture
726 echo -- builds all build types for x86
727 echo build all x64 x86 Checked Release
728 echo -- builds x64 and x86 architectures, Checked and Release build types for each
732 echo PowerShell v3.0 or later is a prerequisite to build this repository, but it is not accessible.
733 echo Ensure that it is defined in the PATH environment variable.
734 echo Typically it should be %%SYSTEMROOT%%\System32\WindowsPowerShell\v1.0\.
738 echo PowerShell v3.0 or later is a prerequisite to build this repository.
739 echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md
740 echo Download via https://www.microsoft.com/en-us/download/details.aspx?id=40855
744 echo Visual Studio 2015+ ^(Community is free^) is a prerequisite to build this repository.
745 echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md
749 echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^
750 This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
751 at the install location of previous Visual Studio version. The workaround is to copy the DIA SDK folder from the Visual Studio install location ^
752 of the previous version to "%VSINSTALLDIR%" and then build.
753 :: DIA SDK not included in Express editions
754 echo Visual Studio Express does not include the DIA SDK. ^
755 You need Visual Studio 2015+ (Community is free).
756 echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
761 echo %__MsgPrefix% Setting Up the usage of __ToolsetDir:%__ToolsetDir%
763 if /i "%__ToolsetDir%" == "" (
764 echo %__MsgPrefix%Error: A toolset directory is required for the Arm64 Windows build. Use the toolset_dir argument.
768 set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH%
769 set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64
771 %__ToolsetDir%\VC_sdk\inc;^
772 %__ToolsetDir%\sdpublic\sdk\inc;^
773 %__ToolsetDir%\sdpublic\shared\inc;^
774 %__ToolsetDir%\sdpublic\shared\inc\minwin;^
775 %__ToolsetDir%\sdpublic\sdk\inc\ucrt;^
776 %__ToolsetDir%\sdpublic\sdk\inc\minwin;^
777 %__ToolsetDir%\sdpublic\sdk\inc\mincore;^
778 %__ToolsetDir%\sdpublic\sdk\inc\abi;^
779 %__ToolsetDir%\sdpublic\sdk\inc\clientcore;^
780 %__ToolsetDir%\diasdk\include