@@ -8,6 +8,9 @@ if ([string]::IsNullOrEmpty($rootPath)) {
88}
99Write-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