diff --git a/scripts/build.ps1 b/scripts/build.ps1 index f5fe085bc5..f84e19c59e 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -887,10 +887,14 @@ function Create-NugetPackages { Copy-Item (Join-Path $env:TP_PACKAGE_PROJ_DIR "Icon.png") $stagingDir -Force - # Remove all locally built nuget packages before we start creating them - # we are leaving them in the folder after uzipping them for easier review. - if (Test-Path $packageOutputDir) { - Remove-Item $packageOutputDir -Recurse -Force -Exclude "manifest","source-build" + # Packages folder should not be cleared on CI. + # Artifacts from source-build are downloaded into this directory before the build starts, and this would remove them. + if (-not $TPB_CIBuild) { + # Remove all locally built nuget packages before we start creating them + # we are leaving them in the folder after uzipping them for easier review. + if (Test-Path $packageOutputDir) { + Remove-Item $packageOutputDir -Recurse -Force + } } if (-not (Test-Path $packageOutputDir)) {