@@ -60,23 +60,19 @@ jobs:
6060 Write-Host "Building $($sqlproj_file.FullName)"
6161 try {
6262 msbuild "$($sqlproj_file.FullName)" /p:Configuration=Release
63- if (!$?) {
64- $errors = "Failed to build $($sqlproj_file.FullName)"
65- }
6663 } catch {
67- $errors += $_.Exception.Message
64+ # Capture detailed error information
65+ $errorMessage = "Error building $($sqlproj_file.FullName) : $($_.Exception.Message)"
66+ Write-Host $errorMessage
67+ $errors += $errorMessage
6868 }
6969 }
7070 }
7171
72- # Display any accumulated errors
73- if ($errors.Count -gt 0) {
74- Write-Error "SQL Project Build Errors:"
75- $errors | ForEach-Object { Write-Error $_ }
76- }
77-
78- # Exit with failure if there are errors
72+ # Display all accumulated errors
7973 if ($errors.Count -gt 0) {
74+ Write-Host "SQL Project Build Errors:"
75+ $errors | ForEach-Object { Write-Host $_ }
8076 exit 1
8177 }
8278
@@ -98,23 +94,19 @@ jobs:
9894 Write-Host "Building $($csproj_file.FullName)"
9995 try {
10096 dotnet build "$($csproj_file.FullName)" --configuration Release
101- if (!$?) {
102- $errors = "Failed to build $($csproj_file.FullName)"
103- }
10497 } catch {
105- $errors += $_.Exception.Message
98+ # Capture detailed error information
99+ $errorMessage = "Error building $($csproj_file.FullName) : $($_.Exception.Message)"
100+ Write-Host $errorMessage
101+ $errors += $errorMessage
106102 }
107103 }
108104 }
109105
110- # Display any accumulated errors
111- if ($errors.Count -gt 0) {
112- Write-Error "Solution Build Errors:"
113- $errors | ForEach-Object { Write-Error $_ }
114- }
115-
116- # Exit with failure if there are errors
106+ # Display all accumulated errors
117107 if ($errors.Count -gt 0) {
108+ Write-Host "Solution Build Errors:"
109+ $errors | ForEach-Object { Write-Host $_ }
118110 exit 1
119111 }
120112
0 commit comments