Skip to content

Commit 5b90e1e

Browse files
author
Igor Sychev
committed
Parallel dotnet build process.
it's working 2m 24s instead of 3m 48s (sequential execution) theis only one problem... write-host not working inside the workflow
1 parent 0d0b812 commit 5b90e1e

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

cli-windows/build-bits.ps1

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ if ([string]::IsNullOrEmpty($rootPath)) {
88
}
99
Write-Host "Root path used is $rootPath" -ForegroundColor Yellow
1010

11+
workflow BuildAndPublish {
12+
param ([string] $rootPath
13+
)
1114
$projectPaths =
1215
@{Path="$rootPath\src\Web\WebMVC";Prj="WebMVC.csproj"},
1316
@{Path="$rootPath\src\Web\WebSPA";Prj="WebSPA.csproj"},
@@ -21,19 +24,20 @@ $projectPaths =
2124
@{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"},
2225
@{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"}
2326

24-
$projectPaths | foreach {
25-
$projectPath = $_.Path
26-
$projectFile = $_.Prj
27-
$outPath = $_.Path + "\obj\Docker\publish"
28-
$projectPathAndFile = "$projectPath\$projectFile"
29-
Write-Host "Deleting old publish files in $outPath" -ForegroundColor Yellow
30-
remove-item -path $outPath -Force -Recurse -ErrorAction SilentlyContinue
31-
Write-Host "Publishing $projectPathAndFile to $outPath" -ForegroundColor Yellow
32-
dotnet restore $projectPathAndFile
33-
dotnet build $projectPathAndFile
34-
dotnet publish $projectPathAndFile -o $outPath
27+
foreach -parallel ($item in $projectPaths) {
28+
$projectPath = $item.Path
29+
$projectFile = $item.Prj
30+
$outPath = $item.Path + "\obj\Docker\publish"
31+
$projectPathAndFile = "$projectPath\$projectFile"
32+
#Write-Host "Deleting old publish files in $outPath" -ForegroundColor Yellow
33+
remove-item -path $outPath -Force -Recurse -ErrorAction SilentlyContinue
34+
#Write-Host "Publishing $projectPathAndFile to $outPath" -ForegroundColor Yellow
35+
dotnet build $projectPathAndFile
36+
dotnet publish $projectPathAndFile -o $outPath
37+
}
3538
}
3639

40+
BuildAndPublish $rootPath
3741

3842
########################################################################################
3943
# Delete old eShop Docker images

0 commit comments

Comments
 (0)