diff --git a/build.psm1 b/build.psm1 index fa6a8f3e360..e689b6bf521 100644 --- a/build.psm1 +++ b/build.psm1 @@ -2997,7 +2997,13 @@ function New-TestPackage Write-Verbose -Message "Creating destination folder: $Destination" } - $packageRoot = Join-Path $env:TEMP ('TestPackage-' + (new-guid)) + $rootFolder = $env:TEMP + + if (-not $rootFolder -and $env:TF_BUILD) { + $rootFolder = $env:AGENT_WORKFOLDER + } + + $packageRoot = Join-Path $rootFolder ('TestPackage-' + (new-guid)) $null = New-Item -ItemType Directory -Path $packageRoot -Force $packagePath = Join-Path $Destination "TestPackage.zip"