diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml
index 730e38a44a3..9b98a482ec1 100644
--- a/.github/workflows/copilot-setup-steps.yml
+++ b/.github/workflows/copilot-setup-steps.yml
@@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Restore MSBuild
- run: ./eng/common/build.sh --restore
+ run: ./build.sh --restore
- name: Put dotnet on the path
run: echo "PATH=$PWD/.dotnet:$PATH" >> $GITHUB_ENV
diff --git a/.vsts-dotnet-ci.yml b/.vsts-dotnet-ci.yml
index 1dfd65105da..2a354a6895f 100644
--- a/.vsts-dotnet-ci.yml
+++ b/.vsts-dotnet-ci.yml
@@ -44,13 +44,11 @@ jobs:
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- task: BatchScript@1
- displayName: cibuild_bootstrapped_msbuild.cmd
+ displayName: Build (with -mt in stage2)
inputs:
- filename: 'eng/cibuild_bootstrapped_msbuild.cmd'
- arguments: '-onlyDocChanged $(onlyDocChanged) -stage2Properties /mt'
+ filename: 'build.cmd'
+ arguments: '-ci -test -stage2Arguments /mt'
condition: eq(variables.onlyDocChanged, 0)
- env:
- ForceUseXCopyMSBuild: 1
# Task to collect code coverage on Windows. Disabled by default due to being unstable and sometimes it stucks forever
# - task: PowerShell@2
# displayName: Process coverage reports
@@ -157,10 +155,10 @@ jobs:
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- task: BatchScript@1
- displayName: cibuild_bootstrapped_msbuild.cmd
+ displayName: Build (with -mt in stage2)
inputs:
- filename: 'eng/cibuild_bootstrapped_msbuild.cmd'
- arguments: '-msbuildEngine dotnet -onlyDocChanged $(onlyDocChanged) -stage2Properties /mt'
+ filename: 'build.cmd'
+ arguments: '-msbuildEngine dotnet -ci -test -stage2Arguments /mt'
condition: eq(variables.onlyDocChanged, 0)
env:
MSBUILDUSESERVER: "1"
@@ -238,8 +236,9 @@ jobs:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- bash: sudo apt-get update
- bash: sudo apt-get install -y libxml2
- - bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged $(onlyDocChanged) --skipTests --stage2Properties '/mt /p:BuildAnalyzer=true'
- displayName: 'Build with bootstrapped MSBuild and -mt mode'
+ # Intentionally not running tests
+ - bash: . 'build.sh' --ci --stage2Arguments '/mt /p:BuildAnalyzer=true'
+ displayName: Build (with -mt in stage2)
condition: eq(variables.onlyDocChanged, 0)
env:
MSBUILDUSESERVER: "1"
@@ -275,10 +274,10 @@ jobs:
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- task: BatchScript@1
- displayName: cibuild.cmd
+ displayName: Build
inputs:
- filename: 'eng/cibuild.cmd'
- arguments: '-configuration Release -test'
+ filename: 'build.cmd'
+ arguments: '-pack -sign -publish -ci -configuration Release -test'
condition: eq(variables.onlyDocChanged, 0)
# Task to collect code coverage on Windows. Disabled by default due to being unstable and sometimes it stucks forever
# - task: PowerShell@2
@@ -354,8 +353,8 @@ jobs:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- bash: sudo apt-get update
- bash: sudo apt-get install -y libxml2
- - bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged $(onlyDocChanged) --stage2Properties '/mt'
- displayName: CI Build
+ - bash: . 'build.sh' --ci --test --stage2Arguments '/mt'
+ displayName: Build (with -mt in stage2)
condition: eq(variables.onlyDocChanged, 0)
env:
MSBUILDUSESERVER: "1"
@@ -443,8 +442,8 @@ jobs:
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- - bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged $(onlyDocChanged) --stage2Properties '/mt'
- displayName: CI Build
+ - bash: . 'build.sh' --ci --test --stage2Arguments '/mt'
+ displayName: Build (with -mt in stage2)
condition: eq(variables.onlyDocChanged, 0)
env:
MSBUILDUSESERVER: "1"
diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml
index 1603c50435f..a7ff56d5877 100644
--- a/.vsts-dotnet.yml
+++ b/.vsts-dotnet.yml
@@ -2,12 +2,6 @@ trigger:
- main
- vs*
-# If defined here, these values are not overrideable
-# Once they exist, we should define these as "runtime parameters"
-# https://github.com/Microsoft/azure-pipelines-yaml/pull/129
-# variables:
-# SkipApplyOptimizationData: false
-
parameters:
- name: OptProfDropName
displayName: Optional OptProfDrop Override
@@ -59,10 +53,10 @@ variables:
value: ${{ parameters.OptProfDropName }}
- name: SourceBranch
value: ''
- # Override SkipApplyOptimizationData to true when disabling OptProf data collection
+ # Set SkipApplyOptimizationDataArg when disabling OptProf data collection
- ${{ if eq(parameters.enableOptProf, false) }}:
- - name: SkipApplyOptimizationData
- value: true
+ - name: SkipApplyOptimizationDataArg
+ value: '/p:EnableNgenOptimization=false'
- name: EnableReleaseOneLocBuild
value: false
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
diff --git a/azure-pipelines/.vsts-dotnet-build-jobs.yml b/azure-pipelines/.vsts-dotnet-build-jobs.yml
index 6b6f9152d00..a586cab2c70 100644
--- a/azure-pipelines/.vsts-dotnet-build-jobs.yml
+++ b/azure-pipelines/.vsts-dotnet-build-jobs.yml
@@ -117,10 +117,11 @@ jobs:
inputs:
dropName: $(VisualStudio.DropName)
- - script: eng/CIBuild.cmd
+ - script: build.cmd
+ -pack -sign -publish -ci
-configuration $(BuildConfiguration)
-officialBuildId $(Build.BuildNumber)
- -officialSkipApplyOptimizationData $(SkipApplyOptimizationData)
+ $(SkipApplyOptimizationDataArg)
/p:RepositoryName=$(Build.Repository.Name)
/p:VisualStudioIbcSourceBranchName=$(SourceBranch)
/p:VisualStudioDropAccessToken=$(System.AccessToken)
@@ -139,6 +140,14 @@ jobs:
# Required by Microsoft policy
- template: /eng/common/templates-official/steps/generate-sbom.yml@self
+ # Compute the .vsman manifest list (generated by the Build step above) consumed by MicroBuildBuildVSBootstrapper below.
+ - pwsh: |
+ $insertionDir = "$(Build.SourcesDirectory)\artifacts\VSSetup\$(BuildConfiguration)\Insertion"
+ $manifestList = (Get-ChildItem "$insertionDir\*.vsman" | Select-Object -ExpandProperty FullName) -join ','
+ Write-Host "##vso[task.setvariable variable=VisualStudio.SetupManifestList;]$manifestList"
+ displayName: 'OptProf - Set manifest list'
+ condition: and(succeeded(), ${{ parameters.enableOptProf }})
+
# Build VS bootstrapper
# Generates $(Build.StagingDirectory)\MicroBuild\Output\BootstrapperInfo.json
- task: MicroBuildBuildVSBootstrapper@3
diff --git a/azure-pipelines/.vsts-dotnet-exp-perf.yml b/azure-pipelines/.vsts-dotnet-exp-perf.yml
index ac9aab87104..2357debcb2a 100644
--- a/azure-pipelines/.vsts-dotnet-exp-perf.yml
+++ b/azure-pipelines/.vsts-dotnet-exp-perf.yml
@@ -2,12 +2,6 @@ trigger:
- exp/*
- perf/*
-# If defined here, these values are not overrideable
-# Once they exist, we should define these as "runtime parameters"
-# https://github.com/Microsoft/azure-pipelines-yaml/pull/129
-# variables:
-# SkipApplyOptimizationData: false
-
parameters:
- name: OptProfDropName
displayName: Optional OptProfDrop Override
diff --git a/azure-pipelines/cts-steps/apply-steps.yml b/azure-pipelines/cts-steps/apply-steps.yml
index 42efb4266f3..5398327630f 100644
--- a/azure-pipelines/cts-steps/apply-steps.yml
+++ b/azure-pipelines/cts-steps/apply-steps.yml
@@ -186,15 +186,15 @@ steps:
# + the bundled SDK props). See collect-steps.yml.
# UsingToolVisualStudioIbcTraining=false: see collect-steps.yml note.
if ($IsWindows) {
- & "$(Build.SourcesDirectory)/eng/common/build.ps1" `
- -restore -build `
+ & "$(Build.SourcesDirectory)/build.cmd" `
+ -ci `
-configuration $(BuildConfiguration) `
-projects "$(Build.SourcesDirectory)/MSBuild.VSTest.slnx" `
-verbosity minimal `
/p:UsingToolVisualStudioIbcTraining=false
} else {
- bash "$(Build.SourcesDirectory)/eng/common/build.sh" `
- --restore --build `
+ bash "$(Build.SourcesDirectory)/build.sh" `
+ --ci `
--configuration $(BuildConfiguration) `
--projects "$(Build.SourcesDirectory)/MSBuild.VSTest.slnx" `
--verbosity minimal `
diff --git a/azure-pipelines/cts-steps/collect-steps.yml b/azure-pipelines/cts-steps/collect-steps.yml
index 4e8625769f5..b582b7a6b09 100644
--- a/azure-pipelines/cts-steps/collect-steps.yml
+++ b/azure-pipelines/cts-steps/collect-steps.yml
@@ -109,15 +109,15 @@ steps:
# Insertion outputs, so skip Arcade's AfterSigning IBC-inputs step
# which otherwise errors on missing artifacts/VSSetup/Debug/Insertion.
if ($IsWindows) {
- & "$(Build.SourcesDirectory)/eng/common/build.ps1" `
- -restore -build `
+ & "$(Build.SourcesDirectory)/build.cmd" `
+ -ci `
-configuration $(BuildConfiguration) `
-projects "$(Build.SourcesDirectory)/MSBuild.VSTest.slnx" `
-verbosity minimal `
/p:UsingToolVisualStudioIbcTraining=false
} else {
- bash "$(Build.SourcesDirectory)/eng/common/build.sh" `
- --restore --build `
+ bash "$(Build.SourcesDirectory)/build.sh" `
+ --ci `
--configuration $(BuildConfiguration) `
--projects "$(Build.SourcesDirectory)/MSBuild.VSTest.slnx" `
--verbosity minimal `
diff --git a/azure-pipelines/quarantine.yml b/azure-pipelines/quarantine.yml
index 3b1349ba545..9afa9a26659 100644
--- a/azure-pipelines/quarantine.yml
+++ b/azure-pipelines/quarantine.yml
@@ -66,13 +66,11 @@ jobs:
steps:
- template: azure-pipelines/check-documentation-only-change.yml
- task: BatchScript@1
- displayName: cibuild_bootstrapped_msbuild.cmd (quarantined tests only)
+ displayName: Build (quarantined tests only)
inputs:
- filename: 'eng/cibuild_bootstrapped_msbuild.cmd'
- arguments: "-onlyDocChanged 0 -stage2Properties '/mt /p:RunQuarantinedTests=true'"
+ filename: 'build.cmd'
+ arguments: "-ci -test -stage2Arguments '/p:RunQuarantinedTests=true'"
condition: or(ne(variables['Build.Reason'], 'PullRequest'), eq(variables.onlyDocChanged, 0))
- env:
- ForceUseXCopyMSBuild: 1
- task: PublishTestResults@2
displayName: Publish .NET Framework Test Results
inputs:
@@ -120,8 +118,8 @@ jobs:
- template: azure-pipelines/check-documentation-only-change.yml
- bash: sudo apt-get update
- bash: sudo apt-get install -y libxml2
- - bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged 0 --stage2Properties '/mt /p:RunQuarantinedTests=true'
- displayName: CI Build (quarantined tests only)
+ - bash: . 'build.sh' --ci --test --stage2Arguments '/p:RunQuarantinedTests=true'
+ displayName: Build (quarantined tests only)
condition: or(ne(variables['Build.Reason'], 'PullRequest'), eq(variables.onlyDocChanged, 0))
env:
MSBUILDUSESERVER: "1"
@@ -159,8 +157,8 @@ jobs:
timeoutInMinutes: 120
steps:
- template: azure-pipelines/check-documentation-only-change.yml
- - bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged 0 --stage2Properties '/mt /p:RunQuarantinedTests=true'
- displayName: CI Build (quarantined tests only)
+ - bash: . 'build.sh' --ci --test --stage2Arguments '/p:RunQuarantinedTests=true'
+ displayName: Build (quarantined tests only)
condition: or(ne(variables['Build.Reason'], 'PullRequest'), eq(variables.onlyDocChanged, 0))
env:
MSBUILDUSESERVER: "1"
diff --git a/build.cmd b/build.cmd
index 255ccb665ef..75030765f33 100644
--- a/build.cmd
+++ b/build.cmd
@@ -1,10 +1,16 @@
@echo off
setlocal
+
+set _args=%*
+if "%~1"=="-?" set _args=-help
+if "%~1"=="/?" set _args=-help
+
if defined MSBUILDDEBUGONSTART_HARD goto build
if not defined MSBUILDDEBUGONSTART goto build
if %MSBUILDDEBUGONSTART% == 0 goto build
set MSBUILDDEBUGONSTART=
echo To debug the build, define a value for MSBUILDDEBUGONSTART_HARD.
+
:build
-powershell -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0eng\common\build.ps1""" -build -restore %*"
-exit /b %ErrorLevel%
+powershell -ExecutionPolicy ByPass -NoProfile -Command "& '%~dp0eng\build.ps1'" -restore -build %_args%
+exit /b %ERRORLEVEL%
diff --git a/build.sh b/build.sh
index f9a7889f52c..69817ae54ef 100755
--- a/build.sh
+++ b/build.sh
@@ -1,11 +1,16 @@
#!/usr/bin/env bash
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- ScriptRoot="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ $SOURCE != /* ]] && SOURCE="$ScriptRoot/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+source="${BASH_SOURCE[0]}"
+
+# resolve $SOURCE until the file is no longer a symlink
+while [[ -h $source ]]; do
+ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+ source="$(readlink "$source")"
+
+ # if $source was a relative symlink, we need to resolve it relative to the path where the
+ # symlink file was located
+ [[ $source != /* ]] && source="$scriptroot/$source"
done
-ScriptRoot="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-. "$ScriptRoot/eng/common/build.sh" --build --restore "$@"
+scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+"$scriptroot/eng/build.sh" --restore --build "$@"
\ No newline at end of file
diff --git a/documentation/wiki/Building-Testing-and-Debugging-on-Full-Framework-MSBuild.md b/documentation/wiki/Building-Testing-and-Debugging-on-Full-Framework-MSBuild.md
index b4fe8cc796b..6654f6f618c 100644
--- a/documentation/wiki/Building-Testing-and-Debugging-on-Full-Framework-MSBuild.md
+++ b/documentation/wiki/Building-Testing-and-Debugging-on-Full-Framework-MSBuild.md
@@ -29,7 +29,7 @@ Some tests are creating symlinks to test associated functionality - in order for
* Enable [Development Mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) on your machine.
* Or run those tests elevated
-To mimic our CI job use `eng\CIBuild.cmd`. Be aware that this command may delete your local NuGet cache.
+To mimic our CI job run `build.cmd -pack -sign -publish -ci`.
The CI does two builds. In the second build, it uses the binaries from the first build to build the repository again.
diff --git a/eng/CIBuild.cmd b/eng/CIBuild.cmd
deleted file mode 100644
index 197c9685009..00000000000
--- a/eng/CIBuild.cmd
+++ /dev/null
@@ -1,2 +0,0 @@
-@echo off
-powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" -restore -build -sign -pack -publish -ci %*"
diff --git a/eng/ProducesNoOutput.Imports.props b/eng/ProducesNoOutput.Imports.props
deleted file mode 100644
index 8f326fff78e..00000000000
--- a/eng/ProducesNoOutput.Imports.props
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
- $(MSBuildToolsPath)\Microsoft.CSharp.targets
-
- false
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/eng/ProducesNoOutput.Settings.props b/eng/ProducesNoOutput.Settings.props
deleted file mode 100644
index 6d444ba9dd3..00000000000
--- a/eng/ProducesNoOutput.Settings.props
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- false
- false
- Library
- false
- false
- false
- true
- true
- $(MSBuildThisFileDirectory)ProducesNoOutput.Imports.props
- true
-
-
diff --git a/eng/build.ps1 b/eng/build.ps1
index d71fa299fd8..0489c33d31b 100644
--- a/eng/build.ps1
+++ b/eng/build.ps1
@@ -1,205 +1,135 @@
-#
-# Copyright (c) .NET Foundation and contributors. All rights reserved.
-# Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#
-
[CmdletBinding(PositionalBinding=$false)]
Param(
- [string][Alias('c')]$configuration = "Debug",
- [string] $projects,
- [string][Alias('v')]$verbosity = "minimal",
- [string] $msbuildEngine = $null,
- [bool] $warnAsError = $true,
- [bool] $nodeReuse = $true,
- [switch][Alias('r')]$restore,
- [switch] $deployDeps,
- [switch][Alias('b')]$build,
- [switch] $rebuild,
- [switch] $deploy,
+ [string] $msbuildEngine,
+ [string] $configuration = "Debug",
[switch] $test,
- [switch] $integrationTest,
- [switch] $performanceTest,
- [switch] $sign,
- [switch] $pack,
- [switch] $publish,
- [switch][Alias('bl')]$binaryLog,
- [switch] $ci,
- [switch] $prepareMachine,
- [switch] $help,
-
- # official build settings
- [string]$officialBuildId = "",
- [string]$officialSkipApplyOptimizationData = "",
-
+ [switch] $stage2,
+ [string] $stage2Arguments = "",
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
)
-function Print-Usage() {
- Write-Host "Common settings:"
- Write-Host " -configuration Build configuration: 'Debug' or 'Release' (short: -c)"
- Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
- Write-Host " -binaryLog Output binary log (short: -bl)"
- Write-Host ""
-
- Write-Host "Actions:"
- Write-Host " -restore Restore dependencies (short: -r)"
- Write-Host " -build Build solution (short: -b)"
- Write-Host " -rebuild Rebuild solution"
- Write-Host " -deploy Deploy built VSIXes"
- Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)"
- Write-Host " -test Run all unit tests in the solution"
- Write-Host " -pack Package build outputs into NuGet packages and Willow components"
- Write-Host " -help Print help and exit"
- Write-Host " -integrationTest Run all integration tests in the solution"
- Write-Host " -performanceTest Run all performance tests in the solution"
- Write-Host " -sign Sign build outputs"
- Write-Host " -publish Publish artifacts (e.g. symbols)"
- Write-Host ""
-
- Write-Host "Advanced settings:"
- Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)"
- Write-Host " -ci Set when running on CI server"
- Write-Host " -prepareMachine Prepare machine for CI run"
- Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
- Write-Host ""
-
- Write-Host "Official build settings:"
- Write-Host " -officialBuildId An official build id, e.g. 20190102.3"
- Write-Host " -officialSkipApplyOptimizationData Pass 'true' to not apply optimization data"
- Write-Host ""
- Write-Host "Command line arguments not listed above are passed thru to msbuild."
- Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)."
-}
-
-function Process-Arguments() {
- function OfficialBuildOnly([string]$argName) {
- if ((Get-Variable $argName -Scope Script).Value) {
- if (!$officialBuildId) {
- Write-Host "$argName can only be specified for official builds"
- exit 1
- }
- } else {
- if ($officialBuildId) {
- Write-Host "$argName must be specified in official builds"
- exit 1
- }
- }
- }
-
- if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) {
- Print-Usage
- exit 0
- }
-
- OfficialBuildOnly "officialSkipApplyOptimizationData"
+$pwshPath = (Get-Process -Id $PID).Path
+$buildScript = Join-Path $PSScriptRoot 'common\build.ps1'
- if ($officialBuildId) {
- $script:applyOptimizationData = ![System.Boolean]::Parse($officialSkipApplyOptimizationData)
- } else {
- $script:applyOptimizationData = $false
- }
+# Arguments common to the stage1 and stage2 builds, including any caller-supplied $properties.
+$commonBuildArgs = @('-configuration', $configuration) + $properties
- if ($ci) {
- $script:binaryLog = $true
- $script:nodeReuse = $false
- }
+# Forward the argument if supplied. Needs to be done for all above explicit parameters that should be passed to the build.
+if ($msbuildEngine) {
+ $commonBuildArgs += '-msbuildEngine'
+ $commonBuildArgs += $msbuildEngine
}
-function Build-Repo() {
- $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" }
- $toolsetBuildProj = InitializeToolset
+# Supplying stage2Arguments implies a multi-stage build
+if ($stage2Arguments) {
+ $stage2 = $true
+}
- if ($projects) {
- # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons.
- # Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty.
- [string[]] $msbuildArgs = $properties
- $msbuildArgs += "/p:Projects=$projects"
- $properties = $msbuildArgs
- }
+$buildArgs = $commonBuildArgs
- # Do not set this property to true explicitly, since that would override values set in projects.
- $suppressPartialNgenOptimization = if (!$applyOptimizationData) { "/p:EnableNgenOptimization=false" } else { "" }
-
- MSBuild $toolsetBuildProj `
- $bl `
- /p:Configuration=$configuration `
- /p:RepoRoot=$RepoRoot `
- /p:Restore=$restore `
- /p:DeployDeps=$deployDeps `
- /p:Build=$build `
- /p:Rebuild=$rebuild `
- /p:Deploy=$deploy `
- /p:Test=$test `
- /p:Pack=$pack `
- /p:IntegrationTest=$integrationTest `
- /p:PerformanceTest=$performanceTest `
- /p:Sign=$sign `
- /p:Publish=$publish `
- /p:ContinuousIntegrationBuild=$ci `
- /p:OfficialBuildId=$officialBuildId `
- $suppressPartialNgenOptimization `
- @properties
+# If the caller requested a multi-stage build, add the -prepareMachine switch to the stage 1 build so that it kills any lingering processes from stage 1 before stage 2 starts.
+# Also disable the pipeline set result masking for stage 1 so that a stage 1 failure surfaces its real exit code to this wrapper (stage 2 is the terminal build that reports the pipeline result).
+if ($stage2) {
+ $buildArgs += '-prepareMachine'
+ $buildArgs += '-disablePipelineSetResult'
}
-# Set VSO variables used by MicroBuildBuildVSBootstrapper pipeline task
-function Set-OptProfVariables() {
- $insertionDir = Join-Path $VSSetupDir "Insertion"
- $manifestList = [string]::Join(',', (Get-ChildItem "$insertionDir\*.vsman"))
- Write-Host "##vso[task.setvariable variable=VisualStudio.SetupManifestList;]$manifestList"
+if ($test -and -not $stage2) {
+ $buildArgs += '-test'
}
-function Check-EditedFiles() {
- # Log VSTS errors for changed lines
- git --no-pager diff HEAD --unified=0 --no-color --exit-code -- src/ | ForEach-Object { "##vso[task.logissue type=error] $_" }
- if ($LASTEXITCODE -ne 0) {
- throw "##vso[task.logissue type=error] After building, there are changed files. Please build locally and include these changes in your pull request."
- }
+# Log the stage 1 build command so that it's clear which arguments flow to it.
+if ($stage2) {
+ Write-Host "Stage 1 build: & `"$buildScript`" $buildArgs"
}
-function Check-RequiredVersionBumps() {
- # Log VSTS errors for missing required version bumps
- $targetBranch = $env:SYSTEM_PULLREQUEST_TARGETBRANCH
- if ($targetBranch) {
- # Some PRs specify the bare target branch (most commonly "main"), some prefix it with "refs/heads/".
- # The following statement normalizes both to a revision spec that git understands.
- $targetBranch = "refs/remotes/origin/" + ($targetBranch -replace "^refs/heads/", "")
- $versionLineChanged = $false
- git --no-pager diff --unified --no-color --exit-code -w $targetBranch HEAD src\Framework\EngineServices.cs `
- | Select-String -Pattern "int Version =" | ForEach-Object -process { $versionLineChanged = $true }
- if (($LASTEXITCODE -ne 0) -and (-not $versionLineChanged)) {
- throw "##vso[task.logissue type=error] Detected changes in Framework\EngineServices.cs without a version bump. " +
- "If you are making API changes, please bump the version. " +
- "If the changes in the file are cosmetic, please change an inline comment on the `"int Version =`" line in EngineServices.cs to silence the error."
- }
- }
-}
+& $pwshPath -NoLogo -NoProfile -ExecutionPolicy ByPass -File "$buildScript" @buildArgs
-try {
- Process-Arguments
+if (-not $stage2) {
+ exit $LASTEXITCODE
+}
- # Import Arcade functions
- . (Join-Path $PSScriptRoot "common\tools.ps1")
- . (Join-Path $PSScriptRoot "configure-toolset.ps1")
+### END of stage1 build ###
- $VSSetupDir = Join-Path $ArtifactsDir "VSSetup\$configuration"
+if ($LASTEXITCODE -ne 0) {
+ throw "Stage 1 build failed with exit code $LASTEXITCODE"
+}
- if ($ci -and $build) {
- Check-RequiredVersionBumps
+$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
+$ArtifactsDir = Join-Path $RepoRoot 'artifacts'
+$Stage1Dir = Join-Path $RepoRoot 'stage1'
+$Stage1BinDir = Join-Path $Stage1Dir 'bin'
+$PerfLogDir = Join-Path $ArtifactsDir "log\$configuration\PerformanceLogs"
+$BootstrapRoot = Join-Path $Stage1BinDir "bootstrap"
+
+# Clean a previous stage1 artifacts folder and move the stage 1 outputs aside so stage 2 gets a clean $ArtifactsDir to build into.
+Remove-Item -Force -Recurse $Stage1Dir -ErrorAction SilentlyContinue
+Move-Item -Path $ArtifactsDir -Destination $Stage1Dir -Force
+
+# Mirror of tools.ps1 GetDefaultMSBuildEngine: presence of tools.vs => 'vs', else tools.dotnet => 'dotnet'.
+$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | ConvertFrom-Json
+if (-not $msbuildEngine) {
+ if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') {
+ $msbuildEngine = 'vs'
+ } elseif (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') {
+ $msbuildEngine = 'dotnet'
+ } else {
+ Write-Host 'error: -msbuildEngine must be specified, or global.json must specify tools.dotnet or tools.vs.'
+ exit 1
}
+}
- Build-Repo
-
- if ($ci -and $build) {
- Set-OptProfVariables
-
- Check-EditedFiles
- }
+if ($msbuildEngine -eq 'vs')
+{
+ $buildToolPath = Join-Path $BootstrapRoot "net472\MSBuild\Current\Bin\MSBuild.exe"
+ $buildToolCommand = "";
+}
+else
+{
+ $buildToolPath = "$BootstrapRoot\core\dotnet.exe"
+ $buildToolCommand = "msbuild"
+ $env:DOTNET_ROOT="$BootstrapRoot\core"
}
-catch {
- Write-Host $_
- Write-Host $_.Exception
- Write-Host $_.ScriptStackTrace
- ExitWithExitCode 1
+
+# Communicate the bootstrapped build tool to the (out-of-proc) stage 2 build.ps1 via environment
+# variables so it does not require dot-sourcing tools.ps1 here. tools.ps1's InitializeBuildTool
+# honors _BuildToolPath / _BuildToolCommand and only consumes Path and Command.
+$env:_BuildToolPath = $buildToolPath
+$env:_BuildToolCommand = $buildToolCommand
+
+# Ensure that debug bits fail fast, rather than hanging waiting for a debugger attach.
+$env:MSBUILDDONOTLAUNCHDEBUGGER="true"
+
+# Opt into performance logging. https://github.com/dotnet/msbuild/issues/5900
+$env:DOTNET_PERFLOG_DIR=$PerfLogDir
+
+# Point child processes (stage 2 build.ps1, tests, and the MSBuild grandchildren they spawn, notably
+# net472 x86 testhosts invoking .NET Core MSBuild → /mt → sidecar TaskHost) at the freshly-built
+# bootstrap .NET host, so task hosts launch with the bits under test. This matches DOTNET_ROOT (set
+# above for the core engine) and the bootstrap's own expectation that tests invoke the bootstrap dotnet
+# (see eng/BootStrapMsBuild.targets).
+$env:DOTNET_HOST_PATH = Join-Path $BootstrapRoot 'core\dotnet.exe'
+$env:DOTNET_INSTALL_DIR = Join-Path $BootstrapRoot 'core'
+
+# $stage2Arguments are appended to the stage 2 build only.
+# Use this for switches like /mt that should not be passed to the stage1 build
+# until a stable version of MT is available in the images.
+# The @(...) wrapper is important: when -split returns exactly one element PowerShell gives back a
+# string, which would later splat one character per argument (so "/mt" becomes "/", "m", "t").
+# Wrapping with @() forces an array even for a single token.
+$stage2Args = @(if ($stage2Arguments) { $stage2Arguments -split '\s+' | Where-Object { $_ } } else { @() })
+
+$stage2BuildArgs = $commonBuildArgs
+
+# Only run tests in stage2 when supplying the '-test' switch in a multi-stage build.
+if ($test) {
+ $stage2BuildArgs += '-test'
}
-ExitWithExitCode 0
+$stage2BuildArgs += $stage2Args
+
+Write-Host "Stage 2 build: & `"$buildScript`" $stage2BuildArgs"
+# Needs to run out-of-proc to not inherit the stage 1 build's state variables.
+& $pwshPath -NoLogo -NoProfile -ExecutionPolicy ByPass -File "$buildScript" @stage2BuildArgs
+
+exit $LASTEXITCODE
diff --git a/eng/build.sh b/eng/build.sh
new file mode 100755
index 00000000000..6c7fd326c78
--- /dev/null
+++ b/eng/build.sh
@@ -0,0 +1,135 @@
+#! /bin/bash
+
+configuration="Debug"
+test=false
+stage2=false
+stage2Arguments=
+properties=
+
+source="${BASH_SOURCE[0]}"
+
+# resolve $SOURCE until the file is no longer a symlink
+while [[ -h $source ]]; do
+ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+ source="$(readlink "$source")"
+
+ # if $source was a relative symlink, we need to resolve it relative to the path where the
+ # symlink file was located
+ [[ $source != /* ]] && source="$scriptroot/$source"
+done
+
+scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+while [[ $# -gt 0 ]]; do
+ lowerI="$(echo $1 | awk '{print tolower($0)}')"
+ case "$lowerI" in
+ --configuration)
+ configuration=$2
+ shift 2
+ ;;
+ --test)
+ test=true
+ shift 1
+ ;;
+ --stage2)
+ stage2=true
+ shift 1
+ ;;
+ --stage2arguments)
+ stage2Arguments=$2
+ # Supplying stage2Arguments implies a multi-stage build.
+ stage2=true
+ shift 2
+ ;;
+ *)
+ properties="$properties $1"
+ shift 1
+ ;;
+ esac
+done
+
+build_script="$scriptroot/common/build.sh"
+
+# Arguments common to the stage1 and stage2 builds, including any caller-supplied properties.
+common_build_args="--configuration $configuration $properties"
+
+build_args="$common_build_args"
+
+# If the caller requested a multi-stage build, add the --prepareMachine switch to the stage 1 build so that it kills any lingering processes from stage 1 before stage 2 starts.
+# Also disable the pipeline set result masking for stage 1 so that a stage 1 failure surfaces its real exit code to this wrapper (stage 2 is the terminal build that reports the pipeline result).
+if [ "$stage2" = true ]; then
+ build_args="$build_args --prepareMachine --disablePipelineSetResult"
+fi
+
+if [ "$test" = true ] && [ "$stage2" != true ]; then
+ build_args="$build_args --test"
+fi
+
+# Log the stage 1 build command so that it's clear which arguments flow to it.
+if [ "$stage2" = true ]; then
+ echo "Stage 1 build: /bin/bash \"$build_script\" $build_args"
+fi
+
+/bin/bash "$build_script" $build_args
+stage1_exit_code=$?
+
+if [ "$stage2" != true ]; then
+ exit $stage1_exit_code
+fi
+
+### END of stage1 build ###
+
+if [ $stage1_exit_code -ne 0 ]; then
+ echo "Stage 1 build failed with exit code $stage1_exit_code"
+ exit $stage1_exit_code
+fi
+
+repo_root="$scriptroot/.."
+artifacts_dir="$repo_root/artifacts"
+stage1_dir="$repo_root/stage1"
+stage1_bin_dir="$stage1_dir/bin"
+perf_log_dir="$artifacts_dir/log/$configuration/PerformanceLogs"
+bootstrap_root="$stage1_bin_dir/bootstrap"
+
+# Clean a previous stage1 artifacts folder and move the stage 1 outputs aside so stage 2 gets a clean artifacts dir to build into.
+rm -rf "$stage1_dir"
+mv "$artifacts_dir" "$stage1_dir"
+
+build_tool_path="$bootstrap_root/core/dotnet"
+build_tool_command="msbuild"
+export DOTNET_ROOT="$bootstrap_root/core"
+
+# Communicate the bootstrapped build tool to the (out-of-proc) stage 2 build.sh via environment
+# variables so it does not require sourcing tools.sh here. tools.sh's InitializeBuildTool
+# honors _BuildToolPath / _BuildToolCommand and only consumes Path and Command.
+export _BuildToolPath="$build_tool_path"
+export _BuildToolCommand="$build_tool_command"
+
+# Ensure that debug bits fail fast, rather than hanging waiting for a debugger attach.
+export MSBUILDDONOTLAUNCHDEBUGGER=true
+
+# Opt into performance logging.
+export DOTNET_PERFLOG_DIR="$perf_log_dir"
+
+# Point child processes (stage 2 build.sh, tests, and the MSBuild grandchildren they spawn) at the
+# freshly-built bootstrap .NET host, so task hosts launch with the bits under test. This matches
+# DOTNET_ROOT and the bootstrap's own expectation that tests invoke the
+# bootstrap dotnet (see eng/BootStrapMsBuild.targets).
+export DOTNET_HOST_PATH="$bootstrap_root/core/dotnet"
+export DOTNET_INSTALL_DIR="$bootstrap_root/core"
+
+stage2_build_args="$common_build_args"
+
+# Only run tests in stage2 when supplying the '--test' switch in a multi-stage build.
+if [ "$test" = true ]; then
+ stage2_build_args="$stage2_build_args --test"
+fi
+
+# $stage2Arguments are appended to the stage 2 build only.
+# Use this for switches like /mt that should not be passed to the stage1 build
+# until a stable version of MT is available in the images.
+stage2_build_args="$stage2_build_args $stage2Arguments"
+
+echo "Stage 2 build: /bin/bash \"$build_script\" $stage2_build_args"
+# Needs to run out-of-proc to not inherit the stage 1 build's state variables.
+/bin/bash "$build_script" $stage2_build_args
+exit $?
diff --git a/eng/cibuild_bootstrapped_msbuild.cmd b/eng/cibuild_bootstrapped_msbuild.cmd
deleted file mode 100644
index 3cb9ee09ea7..00000000000
--- a/eng/cibuild_bootstrapped_msbuild.cmd
+++ /dev/null
@@ -1,3 +0,0 @@
-@echo off
-powershell -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0cibuild_bootstrapped_msbuild.ps1""" %*"
-exit /b %ErrorLevel%
diff --git a/eng/cibuild_bootstrapped_msbuild.ps1 b/eng/cibuild_bootstrapped_msbuild.ps1
deleted file mode 100644
index 5183b039b2b..00000000000
--- a/eng/cibuild_bootstrapped_msbuild.ps1
+++ /dev/null
@@ -1,122 +0,0 @@
-[CmdletBinding(PositionalBinding=$false)]
-Param(
- [string] $msbuildEngine,
- [string] $configuration = "Debug",
- [switch] $prepareMachine,
- [bool] $buildStage1 = $True,
- [bool] $onlyDocChanged = 0,
- [switch] $skipTests,
- [string] $stage2Properties = "",
- [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
-)
-
-Set-StrictMode -Version 2.0
-$ErrorActionPreference = "Stop"
-
-$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
-$ArtifactsDir = Join-Path $RepoRoot 'artifacts'
-$Stage1Dir = Join-Path $RepoRoot 'stage1'
-$Stage1BinDir = Join-Path $Stage1Dir 'bin'
-$PerfLogDir = Join-Path $ArtifactsDir "log\$configuration\PerformanceLogs"
-
-$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | ConvertFrom-Json
-
-# Mirror of tools.ps1 GetDefaultMSBuildEngine: presence of tools.vs => 'vs', else tools.dotnet => 'dotnet'.
-if (-not $msbuildEngine) {
- if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') {
- $msbuildEngine = 'vs'
- } elseif (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') {
- $msbuildEngine = 'dotnet'
- } else {
- Write-Host 'error: -msbuildEngine must be specified, or global.json must specify tools.dotnet or tools.vs.'
- exit 1
- }
-}
-
-# build.ps1 is invoked out-of-proc via the host process (pwsh.exe or powershell.exe). -File starts a fresh
-# process so build.ps1 does not inherit this script's PowerShell scope. Args after -File are parsed as a
-# command line, so named switches (-restore, -build, ...) bind correctly; passing the arg arrays via
-# splatting (@args) keeps each element a distinct argument, preserving values that contain spaces.
-$pwshPath = (Get-Process -Id $PID).Path
-$buildScript = Join-Path $PSScriptRoot 'common\build.ps1'
-
-# Arguments common to both the stage 1 and stage 2 builds, including any caller-supplied $properties.
-$commonBuildArgs = @('-restore', '-build', '-ci', '-prepareMachine', '-configuration', $configuration, '-msbuildEngine', $msbuildEngine) + $properties
-
-if ($buildStage1)
-{
- Write-Host "& $buildScript $($commonBuildArgs -join ' ')"
- & $pwshPath -NoLogo -NoProfile -ExecutionPolicy ByPass -File $buildScript @commonBuildArgs
- if ($LASTEXITCODE -ne 0) {
- throw "Stage 1 build.ps1 failed with exit code $LASTEXITCODE"
- }
-
- # Move the stage 1 outputs aside so stage 2 gets a clean $ArtifactsDir to build into.
- if (Test-Path $Stage1Dir)
- {
- Remove-Item -Force -Recurse $Stage1Dir
- }
-
- Move-Item -Path $ArtifactsDir -Destination $Stage1Dir -Force
-}
-
-# Resolve the bootstrapped build tool AFTER the stage 1 outputs have been moved into $Stage1Dir, so the
-# globbed paths below point at files that actually exist.
-$bootstrapRoot = Join-Path $Stage1BinDir "bootstrap"
-
-if ($msbuildEngine -eq 'vs')
-{
- $buildToolPath = Join-Path $bootstrapRoot "net472\MSBuild\Current\Bin\MSBuild.exe"
- $buildToolCommand = "";
-}
-else
-{
- $buildToolPath = "$bootstrapRoot\core\dotnet.exe"
- $buildToolCommand = "msbuild"
- $env:DOTNET_ROOT="$bootstrapRoot\core"
-}
-
-# Communicate the bootstrapped build tool to the (out-of-proc) stage 2 build.ps1 via environment
-# variables so it does not require dot-sourcing tools.ps1 here. tools.ps1's InitializeBuildTool
-# honors _BuildToolPath / _BuildToolCommand and only consumes Path and Command.
-$env:_BuildToolPath = $buildToolPath
-$env:_BuildToolCommand = $buildToolCommand
-
-# Ensure that debug bits fail fast, rather than hanging waiting for a debugger attach.
-$env:MSBUILDDONOTLAUNCHDEBUGGER="true"
-
-# Opt into performance logging. https://github.com/dotnet/msbuild/issues/5900
-$env:DOTNET_PERFLOG_DIR=$PerfLogDir
-
-# Point child processes (stage 2 build.ps1, tests, and the MSBuild grandchildren they spawn, notably
-# net472 x86 testhosts invoking .NET Core MSBuild → /mt → sidecar TaskHost) at the freshly-built
-# bootstrap .NET host, so task hosts launch with the bits under test. This matches DOTNET_ROOT (set
-# above for the core engine) and the bootstrap's own expectation that tests invoke the bootstrap dotnet
-# (see eng/BootStrapMsBuild.targets).
-$env:DOTNET_HOST_PATH = Join-Path $bootstrapRoot 'core\dotnet.exe'
-$env:DOTNET_INSTALL_DIR = Join-Path $bootstrapRoot 'core'
-
-# $stage2Properties are appended to the stage 2 build only.
-# Use this for switches like /mt that should not be passed to the stable MSBuild used in stage 1
-# until a stable version of MT is available in the images.
-# The @(...) wrapper is important: when -split returns exactly one element PowerShell gives back a
-# string, which would later splat one character per argument (so "/mt" becomes "/", "m", "t").
-# Wrapping with @() forces an array even for a single token.
-$stage2Args = @(if ($stage2Properties) { $stage2Properties -split '\s+' | Where-Object { $_ } } else { @() })
-
-# Stage 2 shares the common build args and additionally:
-# onlyDocChanged=1 → bootstrap not created (artifacts not needed downstream)
-# skipTests → bootstrap IS created (downstream MAY consume it), tests omitted
-# default → bootstrap created, tests run
-$stage2BuildArgs = $commonBuildArgs
-if ($onlyDocChanged) {
- $stage2BuildArgs += '/p:CreateBootstrap=false'
-}
-elseif (-not $skipTests) {
- $stage2BuildArgs += '-test'
-}
-$stage2BuildArgs += $stage2Args
-
-Write-Host "& $buildScript $($stage2BuildArgs -join ' ')"
-& $pwshPath -NoLogo -NoProfile -ExecutionPolicy ByPass -File $buildScript @stage2BuildArgs
-exit $LASTEXITCODE
diff --git a/eng/cibuild_bootstrapped_msbuild.sh b/eng/cibuild_bootstrapped_msbuild.sh
deleted file mode 100755
index 7d0aa62865e..00000000000
--- a/eng/cibuild_bootstrapped_msbuild.sh
+++ /dev/null
@@ -1,114 +0,0 @@
-#! /bin/bash
-
-configuration="Debug"
-build_stage1=true
-onlyDocChanged=0
-skipTests=false
-properties=
-stage2Properties=
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- ScriptRoot="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ $SOURCE != /* ]] && SOURCE="$ScriptRoot/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-ScriptRoot="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-while [[ $# -gt 0 ]]; do
- lowerI="$(echo $1 | awk '{print tolower($0)}')"
- case "$lowerI" in
- --configuration)
- configuration=$2
- shift 2
- ;;
- --build_stage1)
- build_stage1=$2
- shift 2
- ;;
- --onlydocchanged)
- onlyDocChanged=$2
- shift 2
- ;;
- --skiptests)
- skipTests=true
- shift 1
- ;;
- --stage2properties)
- stage2Properties=$2
- shift 2
- ;;
- *)
- properties="$properties $1"
- shift 1
- ;;
- esac
-done
-
-RepoRoot="$ScriptRoot/.."
-ArtifactsDir="$RepoRoot/artifacts"
-Stage1Dir="$RepoRoot/stage1"
-PerfLogDir="$ArtifactsDir/log/$configuration/PerformanceLogs"
-
-# This script intentionally does NOT source eng/common/tools.sh. Sourcing would pull tools.sh's variables
-# into this scope and force in-proc execution of build.sh. Instead we invoke build.sh out-of-proc (see the
-# /bin/bash calls below) and compute the few values we need (repo paths, build tool) directly.
-build_script="$ScriptRoot/common/build.sh"
-
-# Arguments common to both the stage 1 and stage 2 builds, including any caller-supplied properties.
-common_build_args="--restore --build --ci --prepareMachine --configuration $configuration $properties"
-
-if [[ $build_stage1 == true ]]
-then
- echo "/bin/bash \"$build_script\" $common_build_args"
- /bin/bash "$build_script" $common_build_args || exit $?
-
- # Move the stage 1 outputs aside so stage 2 gets a clean artifacts dir to build into.
- rm -rf "$Stage1Dir"
- mv "$ArtifactsDir" "$Stage1Dir"
-fi
-
-# Resolve the bootstrapped build tool AFTER the stage 1 outputs have been moved into $Stage1Dir, so the
-# globbed paths below point at files that actually exist.
-bootstrapRoot="$Stage1Dir/bin/bootstrap"
-
-# Communicate the bootstrapped build tool to the (out-of-proc) stage 2 build.sh via environment
-# variables so it does not require sourcing tools.sh here. tools.sh's InitializeBuildTool honors
-# _BuildToolPath / _BuildToolCommand.
-export _BuildToolPath="$bootstrapRoot/core/dotnet"
-export _BuildToolCommand="msbuild"
-
-export DOTNET_ROOT="$bootstrapRoot/core"
-
-# Ensure that debug bits fail fast, rather than hanging waiting for a debugger attach.
-export MSBUILDDONOTLAUNCHDEBUGGER=true
-
-# Opt into performance logging.
-export DOTNET_PERFLOG_DIR="$PerfLogDir"
-
-# Point child processes (stage 2 build.sh, tests, and the MSBuild grandchildren they spawn) at the
-# freshly-built bootstrap .NET host, so task hosts launch with the bits under test. This matches
-# DOTNET_ROOT and the bootstrap's own expectation that tests invoke the bootstrap dotnet (see
-# eng/BootStrapMsBuild.targets).
-export DOTNET_HOST_PATH="$bootstrapRoot/core/dotnet"
-export DOTNET_INSTALL_DIR="$bootstrapRoot/core"
-
-# stage2Properties are passed to the stage 2 build only since some MSBuild switches (like /mt) may not
-# work with the SDK MSBuild used in stage 1. Mirroring the branches:
-# onlyDocChanged=1 -> bootstrap not created (artifacts not needed downstream)
-# skipTests -> bootstrap IS created, tests omitted
-# default -> bootstrap created, tests run
-stage2_build_args="$common_build_args $stage2Properties"
-if [ $onlyDocChanged = 0 ]
-then
- if [ "$skipTests" != true ]
- then
- stage2_build_args="$stage2_build_args --test"
- fi
-else
- stage2_build_args="$stage2_build_args /p:CreateBootstrap=false"
-fi
-
-echo "/bin/bash \"$build_script\" $stage2_build_args"
-/bin/bash "$build_script" $stage2_build_args
-exit $?
diff --git a/eng/common/build.ps1 b/eng/common/build.ps1
index 2cbb725323e..dd84699f500 100644
--- a/eng/common/build.ps1
+++ b/eng/common/build.ps1
@@ -23,6 +23,7 @@ Param(
[switch] $clean,
[switch][Alias('pb')]$productBuild,
[switch]$fromVMR,
+ [switch]$disablePipelineSetResult,
[switch][Alias('bl')]$binaryLog,
[string][Alias('bln')]$binaryLogName = '',
[switch][Alias('nobl')]$excludeCIBinarylog,
@@ -80,6 +81,7 @@ function Print-Usage() {
Write-Host " -nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')"
Write-Host " -buildCheck Sets /check msbuild parameter"
Write-Host " -fromVMR Set when building from within the VMR"
+ Write-Host " -disablePipelineSetResult Set to disable masking the actual exit code in the pipeline when the build fails"
Write-Host ""
Write-Host "Command line arguments not listed above are passed thru to msbuild."
diff --git a/eng/common/build.sh b/eng/common/build.sh
index 3a9fdcfd0f5..4437f26010a 100755
--- a/eng/common/build.sh
+++ b/eng/common/build.sh
@@ -46,6 +46,7 @@ usage()
echo " --warnNotAsError Sets a semi-colon delimited list of warning codes that should not be treated as errors"
echo " --buildCheck Sets /check msbuild parameter"
echo " --fromVMR Set when building from within the VMR"
+ echo " --disablePipelineSetResult Set to disable masking the actual exit code in the pipeline when the build fails"
echo ""
echo "Command line arguments not listed above are passed thru to msbuild."
echo "Arguments can also be passed in with a single hyphen."
@@ -68,6 +69,7 @@ build=false
source_build=false
product_build=false
from_vmr=false
+disable_pipeline_set_result=false
rebuild=false
test=false
integration_test=false
@@ -152,6 +154,9 @@ while [[ $# -gt 0 ]]; do
-fromvmr|-from-vmr)
from_vmr=true
;;
+ -disablepipelinesetresult|-disable-pipeline-set-result)
+ disable_pipeline_set_result=true
+ ;;
-test|-t)
test=true
;;
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 6f664ad890b..929775b7b08 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -65,6 +65,8 @@ $ErrorActionPreference = 'Stop'
# True when the build is running within the VMR.
[bool]$fromVMR = if (Test-Path variable:fromVMR) { $fromVMR } else { $false }
+[bool]$disablePipelineSetResult = if (Test-Path variable:disablePipelineSetResult) { $disablePipelineSetResult } else { $false }
+
function Create-Directory ([string[]] $path) {
New-Item -Path $path -Force -ItemType 'Directory' | Out-Null
}
@@ -814,7 +816,7 @@ function MSBuild() {
# When running on Azure Pipelines, override the returned exit code to avoid double logging.
# Skip this when the build is a child of the VMR build.
- if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR) {
+ if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR -and !$disablePipelineSetResult) {
Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed."
# Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
# The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
@@ -850,7 +852,7 @@ function DotNet() {
if ($exitCode -ne 0) {
Write-Host "dotnet command failed with exit code $exitCode. Check errors above." -ForegroundColor Red
- if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR) {
+ if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR -and !$disablePipelineSetResult) {
Write-PipelineSetResult -Result "Failed" -Message "dotnet command execution failed."
ExitWithExitCode 0
} else {
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index 347a29b8884..fd5d1ef9a20 100755
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -68,6 +68,8 @@ runtime_source_feed_key=${runtime_source_feed_key:-''}
# True when the build is running within the VMR.
from_vmr=${from_vmr:-false}
+disable_pipeline_set_result=${disable_pipeline_set_result:-false}
+
# Resolve any symlinks in the given path.
function ResolvePath {
local path=$1
@@ -491,7 +493,7 @@ function DotNet {
local exit_code=$?
echo "dotnet command failed with exit code $exit_code. Check errors above."
- if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$from_vmr" != true ]]; then
+ if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$from_vmr" != true && "$disable_pipeline_set_result" != true ]]; then
Write-PipelineSetResult -result "Failed" -message "dotnet command execution failed."
ExitWithExitCode 0
else
@@ -526,7 +528,7 @@ function MSBuild {
# When running on Azure Pipelines, override the returned exit code to avoid double logging.
# Skip this when the build is a child of the VMR build.
- if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$from_vmr" != true ]]; then
+ if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$from_vmr" != true && "$disable_pipeline_set_result" != true ]]; then
Write-PipelineSetResult -result "Failed" -message "msbuild execution failed."
# Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
# The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
diff --git a/eng/configure-toolset.ps1 b/eng/configure-toolset.ps1
deleted file mode 100644
index 03cb64e6c18..00000000000
--- a/eng/configure-toolset.ps1
+++ /dev/null
@@ -1,5 +0,0 @@
-# We can't use already installed dotnet cli since we need to install additional shared runtimes.
-# We could potentially try to find an existing installation that has all the required runtimes,
-# but it's unlikely one will be available.
-
-$useInstalledDotNetCli = $false
diff --git a/eng/configure-toolset.sh b/eng/configure-toolset.sh
deleted file mode 100644
index 392466219d4..00000000000
--- a/eng/configure-toolset.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# We can't use already installed dotnet cli since we need to install additional shared runtimes.
-# We could potentially try to find an existing installation that has all the required runtimes,
-# but it's unlikely one will be available.
-
-useInstalledDotNetCli="false"
\ No newline at end of file
diff --git a/eng/generate-optprof-run-settings.ps1 b/eng/generate-optprof-run-settings.ps1
deleted file mode 100644
index 77b05cee9b4..00000000000
--- a/eng/generate-optprof-run-settings.ps1
+++ /dev/null
@@ -1,43 +0,0 @@
-[CmdletBinding(PositionalBinding=$false)]
-param (
- [string]$configuration,
- [string]$vsDropName,
- [string]$bootstrapperInfo
-)
-
-Set-StrictMode -version 2.0
-$ErrorActionPreference = "Stop"
-
-. (Join-Path $PSScriptRoot "build-utils.ps1")
-
-function Restore-Repo() {
- $toolsetBuildProj = InitializeToolset
-
- MSBuild $toolsetBuildProj `
- /p:RepoRoot=$RepoRoot `
- /p:Restore=$true `
-}
-
-try {
- Restore-Repo
-
- $optProfToolDir = Get-PackageDir "Roslyn.OptProf.RunSettings.Generator"
-
- $optProfToolExe = Join-Path $optProfToolDir "tools\roslyn.optprof.runsettings.generator.exe"
-
- $configFile = Join-Path $EngRoot "config\OptProf.json"
- $runSettingsFile = Join-Path $VSSetupDir "Insertion\RunSettings\MSBuildOptProf.runsettings"
-
- Exec-Console $optProfToolExe "--config $configFile --vsDropName $vsDropName --bootstrapperInfo $bootstrapperInfo --out $runSettingsFile"
-
- exit 0
-}
-catch {
- Write-Host $_
- Write-Host $_.Exception
- Write-Host $_.ScriptStackTrace
- exit 1
-}
-finally {
- Pop-Location
-}
diff --git a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj
index 5b0ce7d8c37..695aebc3ad1 100644
--- a/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj
+++ b/src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj
@@ -37,7 +37,7 @@
-
+
@@ -53,8 +53,6 @@
TargetFramework=$(FullFrameworkTFM)
TargetFramework=$(LatestDotNetCoreForMSBuild)
-
-
@@ -149,4 +147,5 @@
+
diff --git a/src/Framework/Microsoft.Build.Framework.csproj b/src/Framework/Microsoft.Build.Framework.csproj
index b77c0fb5acc..c56360be98f 100644
--- a/src/Framework/Microsoft.Build.Framework.csproj
+++ b/src/Framework/Microsoft.Build.Framework.csproj
@@ -19,14 +19,6 @@
true
-
-
-
- <_PackageFiles Include="$(ArtifactsBinDir)Microsoft.Build.Framework\$(Configuration)\net472\Microsoft.Build.Framework.tlb" PackagePath="tools/net472" />
-
-
-
+
+
+ <_PackageFiles Include="$(ArtifactsBinDir)Microsoft.Build.Framework\$(Configuration)\net472\Microsoft.Build.Framework.tlb" PackagePath="tools/net472" />
+
+
+
+
+
+
+
+ <_EngineServicesTargetBranch>refs/remotes/origin/$(SYSTEM_PULLREQUEST_TARGETBRANCH.Replace('refs/heads/', ''))
+ <_EngineServicesFile>$(MSBuildThisFileDirectory)EngineServices.cs
+
+
+
+
+
+
+
+
+ <_GitAvailable Condition="'$(_GitVersionExitCode)' == '0'">true
+
+
+
+
+
+
+
+
+
+ <_EngineServicesChanged Condition="'$(_EngineServicesDiffExitCode)' == '1'">true
+ <_EngineServicesDiffText>@(_EngineServicesDiff, '%0A')
+ <_EngineServicesVersionChanged>$(_EngineServicesDiffText.Contains('int Version ='))
+
+
+
+
+
diff --git a/src/MSBuildTaskHost/MSBuildTaskHost.csproj b/src/MSBuildTaskHost/MSBuildTaskHost.csproj
index 56f0e0b4b02..0872bbf3710 100644
--- a/src/MSBuildTaskHost/MSBuildTaskHost.csproj
+++ b/src/MSBuildTaskHost/MSBuildTaskHost.csproj
@@ -1,9 +1,5 @@
-
-
-
net35
Exe
@@ -32,6 +28,10 @@
$(DefineConstants);NET20
+
+
+ true
diff --git a/src/Package/DevDivPackage/DevDivPackage.csproj b/src/Package/DevDivPackage/DevDivPackage.csproj
index 9ed627a7938..24b9a8c2fd7 100644
--- a/src/Package/DevDivPackage/DevDivPackage.csproj
+++ b/src/Package/DevDivPackage/DevDivPackage.csproj
@@ -1,15 +1,15 @@
+
+
$(FullFrameworkTFM)
false
VS.ExternalAPIs.MSBuild.nuspec
false
x86
- true
true
-
- true
+ true
@@ -19,11 +19,10 @@
-
-
$(AllowedReferenceRelatedFileExtensions);.tlb
+
diff --git a/src/Package/MSBuild.VSSetup.Arm64/MSBuild.VSSetup.Arm64.csproj b/src/Package/MSBuild.VSSetup.Arm64/MSBuild.VSSetup.Arm64.csproj
index 592cab17e85..b37626dafa3 100644
--- a/src/Package/MSBuild.VSSetup.Arm64/MSBuild.VSSetup.Arm64.csproj
+++ b/src/Package/MSBuild.VSSetup.Arm64/MSBuild.VSSetup.Arm64.csproj
@@ -1,12 +1,12 @@
-
-
+
+
$(FullFrameworkTFM)
Microsoft.Build.Arm64.vsix
Microsoft.Build.Arm64
- false
- true
+
+ true
@@ -22,9 +22,9 @@
-
+
-
+
@@ -33,5 +33,4 @@
-
diff --git a/src/Package/MSBuild.VSSetup/MSBuild.VSSetup.csproj b/src/Package/MSBuild.VSSetup/MSBuild.VSSetup.csproj
index 7e88739f5fc..22099cae281 100644
--- a/src/Package/MSBuild.VSSetup/MSBuild.VSSetup.csproj
+++ b/src/Package/MSBuild.VSSetup/MSBuild.VSSetup.csproj
@@ -1,13 +1,12 @@
-
-
+
+
$(FullFrameworkTFM)
Microsoft.Build.vsix
Microsoft.Build
- false
- true
+ true
@@ -23,13 +22,13 @@
-
-
+
+
+ Condition="'$(ExcludeFromBuild)' != 'true'">
@@ -42,5 +41,4 @@
-
diff --git a/src/Tasks/Copy.cs b/src/Tasks/Copy.cs
index 2d1e8ba2508..1cae5a2d541 100644
--- a/src/Tasks/Copy.cs
+++ b/src/Tasks/Copy.cs
@@ -29,8 +29,6 @@ public class Copy : TaskExtension, IIncrementalTask, ICancelableTask, IMultiThre
{
// Default parallelism determined empirically - times below are in seconds spent in the Copy task building this repo
- // with "build -skiptests -rebuild -configuration Release /ds" (with hack to build.ps1 to disable creating selfhost
- // build for non-selfhost first build; implies first running build in repo to pull packages and create selfhost)
// and comparing the task timings from the default and selfhost binlogs with different settings for this parallelism
// number (via env var override). >=3 samples averaged for each number.
//
diff --git a/src/UnitTests.Shared/RunnerUtilities.cs b/src/UnitTests.Shared/RunnerUtilities.cs
index 4914548b60d..b18820da5e3 100644
--- a/src/UnitTests.Shared/RunnerUtilities.cs
+++ b/src/UnitTests.Shared/RunnerUtilities.cs
@@ -133,8 +133,7 @@ public static string ExecBootstrapedMSBuild(
/// for stage 2). Without this override those leak into the stage 2 test run, so the launched stage 2 bootstrapped
/// MSBuild would resolve the stage 1 SDK/runtime and spawn a mismatched task host, failing with MSB4216. The
/// bootstrap can also target an earlier runtime (e.g. net10.0) than the SDK overlaid into .dotnet, so an ambient
- /// dotnet (e.g. the repo-local .dotnet) may not contain the runtime the bootstrap targets. See
- /// eng/BootStrapMsBuild.targets and eng/cibuild_bootstrapped_msbuild.sh.
+ /// dotnet (e.g. the repo-local .dotnet) may not contain the runtime the bootstrap targets.
///
private static Dictionary GetMSBuildEnvironmentVariables(bool useBootstrapHost)
{