eng/scripts/build.ps1 (31 lines of code) (raw):

$rootDir = Join-Path $PSScriptRoot "../.." # Path to the root of the repository $rootDir = Resolve-Path $rootDir $buildFolderPath = "$rootDir/build" if (-not (Test-Path $buildFolderPath)) { throw "Build folder '$buildFolderPath' does not exist." } Set-Location $buildFolderPath $buildCommand = $null $isReleaseBuild = $null if (-not([bool]::TryParse($env:IsReleaseBuild, [ref] $isReleaseBuild))) { throw "IsReleaseBuild can only be set to true or false." } if ($env:IntegrationBuildNumber) { if (-not ($env:IntegrationBuildNumber -like "PreRelease*-*")) { $integrationBuildNumberExample = "PreRelease" + (Get-Date -Format "yyMMdd-HHmm") $errorMessage = "IntegrationBuildNumber '$env:IntegrationBuildNumber' format is invalid. It should be of the form '$integrationBuildNumberExample'." throw $errorMessage } $buildCommand = { dotnet run --integrationTests } } else { $buildCommand = { dotnet run --ci } } Write-Host "Running $buildCommand" & $buildCommand if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }