From 02eac098470a07269ed3a91ba6003e146d261301 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Mon, 13 Apr 2026 23:15:50 -0600 Subject: [PATCH] Set MSBUILDDEBUGPATH in common build scripts for crash diagnostics Set MSBUILDDEBUGPATH in eng/common/tools.sh and eng/common/tools.ps1 so that MSBuild crash diagnostics (MSB4166 failure.txt files) are written to a known location under artifacts/log//MsbuildDebugLogs/ instead of the system temp directory. This ensures they are captured as build artifacts in CI. Previously individual repos had to set this in their own build scripts (e.g. dotnet/runtime's src/coreclr/build-runtime.sh, src/tests/build.sh). Putting it in the common tooling covers all repos using arcade infrastructure. Relates to dotnet/runtime#92290 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/common/tools.ps1 | 6 ++++++ eng/common/tools.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index e28db6c7c8f..c2f3eb9ba45 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -875,6 +875,12 @@ Create-Directory $ToolsetDir Create-Directory $TempDir Create-Directory $LogDir +# Direct MSBuild crash diagnostics (MSB4166 failure.txt files) to a known location +# under artifacts/log so they are captured as build artifacts in CI. +if (-not $env:MSBUILDDEBUGPATH) { + $env:MSBUILDDEBUGPATH = Join-Path $LogDir 'MsbuildDebugLogs' +} + Write-PipelineSetVariable -Name 'Artifacts' -Value $ArtifactsDir Write-PipelineSetVariable -Name 'Artifacts.Toolset' -Value $ToolsetDir Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 1e37fd95b21..1e44df6294f 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -598,6 +598,12 @@ mkdir -p "$toolset_dir" mkdir -p "$temp_dir" mkdir -p "$log_dir" +# Direct MSBuild crash diagnostics (MSB4166 failure.txt files) to a known location +# under artifacts/log so they are captured as build artifacts in CI. +if [[ -z "${MSBUILDDEBUGPATH:-}" ]]; then + export MSBUILDDEBUGPATH="$log_dir/MsbuildDebugLogs" +fi + Write-PipelineSetVariable -name "Artifacts" -value "$artifacts_dir" Write-PipelineSetVariable -name "Artifacts.Toolset" -value "$toolset_dir" Write-PipelineSetVariable -name "Artifacts.Log" -value "$log_dir"