diff --git a/Tasks/PublishBuildArtifactsV1/Invoke-Robocopy.ps1 b/Tasks/PublishBuildArtifactsV1/Invoke-Robocopy.ps1 index 8bcb809a34dc..fe915998bf96 100644 --- a/Tasks/PublishBuildArtifactsV1/Invoke-Robocopy.ps1 +++ b/Tasks/PublishBuildArtifactsV1/Invoke-Robocopy.ps1 @@ -39,15 +39,16 @@ $writer = New-Object System.IO.StreamWriter($stdout, $utf8) # PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer. if (!$File) { - $File = "*"; + $File = "*"; + $CopySubFoldersOption = "/E" } # Print the ##command. The /MT parameter is only supported on 2008 R2 and higher. if ($ParallelCount -gt 1) { - [System.Console]::WriteLine("##[command]robocopy.exe /E /COPY:DA /NP /R:3 /MT:$ParallelCount `"$Source`" `"$Target`" `"$File`"") + [System.Console]::WriteLine("##[command]robocopy.exe $CopySubFoldersOption /COPY:DA /NP /R:3 /MT:$ParallelCount `"$Source`" `"$Target`" `"$File`"") } else { - [System.Console]::WriteLine("##[command]robocopy.exe /E /COPY:DA /NP /R:3 `"$Source`" `"$Target`" `"$File`"") + [System.Console]::WriteLine("##[command]robocopy.exe $CopySubFoldersOption /COPY:DA /NP /R:3 `"$Source`" `"$Target`" `"$File`"") } # The $OutputEncoding variable instructs PowerShell how to interpret the output @@ -74,7 +75,7 @@ $OutputEncoding = [System.Text.Encoding]::Default # # Note, the /MT parameter is only supported on 2008 R2 and higher. if ($ParallelCount -gt 1) { - & robocopy.exe /E /COPY:DA /NP /R:3 /MT:$ParallelCount $Source $Target $File 2>&1 | + & robocopy.exe $CopySubFoldersOption /COPY:DA /NP /R:3 /MT:$ParallelCount $Source $Target $File 2>&1 | ForEach-Object { if ($_ -is [System.Management.Automation.ErrorRecord]) { [System.Console]::WriteLine($_.Exception.Message) @@ -85,7 +86,7 @@ if ($ParallelCount -gt 1) { } } else { - & robocopy.exe /E /COPY:DA /NP /R:3 $Source $Target $File 2>&1 | + & robocopy.exe $CopySubFoldersOption /COPY:DA /NP /R:3 $Source $Target $File 2>&1 | ForEach-Object { if ($_ -is [System.Management.Automation.ErrorRecord]) { [System.Console]::WriteLine($_.Exception.Message) diff --git a/Tasks/PublishBuildArtifactsV1/task.json b/Tasks/PublishBuildArtifactsV1/task.json index 613e1062cd5d..50b4756fd3d7 100644 --- a/Tasks/PublishBuildArtifactsV1/task.json +++ b/Tasks/PublishBuildArtifactsV1/task.json @@ -12,7 +12,7 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 186, + "Minor": 192, "Patch": 0 }, "demands": [], diff --git a/Tasks/PublishBuildArtifactsV1/task.loc.json b/Tasks/PublishBuildArtifactsV1/task.loc.json index c24abbb11552..5f18599970ee 100644 --- a/Tasks/PublishBuildArtifactsV1/task.loc.json +++ b/Tasks/PublishBuildArtifactsV1/task.loc.json @@ -12,7 +12,7 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 186, + "Minor": 192, "Patch": 0 }, "demands": [],