@@ -283,6 +283,12 @@ cmd.exe /C cd /d "$currentLocation" "&" "$vcvarsallbatPath" "$Arch" "&" "$cmakeP
283283 # Copy the binaries from the local build directory to the packaging directory
284284 $FilesToCopy = @ (' pwrshplugin.dll' , ' pwrshplugin.pdb' )
285285 $dstPath = " $PSScriptRoot \src\powershell-win-core"
286+
287+ if (-not (Test-Path $dstPath ))
288+ {
289+ New-Item - ItemType Directory - Path $dstPath - Force > $null
290+ }
291+
286292 $FilesToCopy | ForEach-Object {
287293 $srcPath = [IO.Path ]::Combine((Get-Location ), " bin" , $Configuration , " CoreClr/$_ " )
288294
@@ -303,12 +309,25 @@ cmd.exe /C cd /d "$location" "&" "$vcvarsallbatPath" "$Arch" "&" "$cmakePath" "$
303309"@
304310 Write-Log " Executing Build Command for PowerShell.Core.Instrumentation: $command "
305311 Start-NativeExecution { Invoke-Expression - Command:$command }
306-
312+ <#
307313 # Copy the binary to the packaging directory
308314 # NOTE: No PDB file; it's a resource-only DLL.
309315 # VS2017 puts this in $HOME\source
310316 $srcPath = [IO.Path]::Combine($HOME, "source", $Configuration, 'PowerShell.Core.Instrumentation.dll')
311- Copy-Item - Path $srcPath - Destination $dstPath
317+ Copy-Item -Path $srcPath -Destination $dstPat
318+ #>
319+
320+ $builtBinary = (Get-ChildItem - Path $location - Filter ' PowerShell.Core.Instrumentation.dll' - Recurse | Select-Object - First 1 ).FullName
321+
322+ if (-not (Test-Path $builtBinary ))
323+ {
324+ throw " PowerShell.Core.Instrumentation was not found under $location "
325+ }
326+ else
327+ {
328+ Copy-Item $builtBinary - Destination $dstPath - Force
329+ }
330+
312331
313332 } finally {
314333 Pop-Location
0 commit comments