Skip to content

Commit 6de2cf2

Browse files
akoeplingerCopilot
andcommitted
Restore InitializeToolset call in MSBuild function
When the Arcade msbuild logger was removed in #16814, the InitializeToolset call in the MSBuild function (tools.{sh,ps1}) was removed alongside it. That call had a load-bearing side effect: InitializeToolset invokes GetNuGetPackageCachePath, which exports NUGET_PACKAGES. Without NUGET_PACKAGES exported, NuGet restore defaults to the user profile while RepoLayout.props sets MSBuild's $(NuGetPackageRoot) to $(RepoRoot)/.packages/ under ContinuousIntegrationBuild=true. Generated .nuget.g.props imports guarded by Exists($(NuGetPackageRoot)...) are silently skipped, and properties contributed by them (e.g. XunitConsoleNetCoreAppPath) end up undefined. Restore the InitializeToolset call in the MSBuild function gated on $ci, matching the pre-#16814 behavior. Placing it in the MSBuild function rather than at tools.{sh,ps1} load time ensures any configure-toolset overrides have already been imported. Fixes #16898 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1cc4e30 commit 6de2cf2

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

eng/common/tools.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ function Stop-Processes() {
748748
#
749749
function MSBuild() {
750750
if ($ci) {
751+
InitializeToolset | Out-Null
752+
751753
$env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20
752754
$env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20
753755
Write-PipelineSetVariable -Name 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value '20'

eng/common/tools.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,8 @@ function MSBuild {
505505
local args=( "$@" )
506506

507507
if [[ "$ci" == true ]]; then
508+
InitializeToolset
509+
508510
export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20
509511
export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20
510512
Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20"

0 commit comments

Comments
 (0)