2222 uses : actions/setup-node@v4
2323 with :
2424 node-version : ' 18'
25- npm : ' 6.14.8'
2625
2726 - name : Typescript install WebUI
2827 run : yarn install --network-timeout 600000 --frozen-lockfile
@@ -43,26 +42,80 @@ jobs:
4342 - name : Setup MSBuild
44434544
46- - name : Build SQL Server Database project
45+ - name : Build SQL Server Database Project
4746 run : |
48- # List all .sqlproj files except for .sqlproj
47+ # Enable strict error handling
48+ $ErrorActionPreference = 'Stop'
49+
50+ # Initialize an error collection
51+ $errors = @()
52+
53+ # List all .sqlproj files
4954 $sqlproj_files = Get-ChildItem -Path . -Filter *.sqlproj -Recurse
50-
51- # Build each .csproj file
52- foreach ($sqlproj_file in $sqlproj_files) {
53- Write-Host "Building $($sqlproj_file.FullName)"
54- msbuild "$($sqlproj_file.FullName)" /p:Configuration=Release
55- }
56- - name : Build solution excluding SQL project
55+
56+ if ($sqlproj_files.Count -eq 0) {
57+ $errors += "No .sqlproj files found."
58+ } else {
59+ foreach ($sqlproj_file in $sqlproj_files) {
60+ Write-Host "Building $($sqlproj_file.FullName)"
61+ try {
62+ $output = &msbuild "$($sqlproj_file.FullName)" /p:Configuration=Release /nologo 2>&1
63+ if (!$?) {
64+ $errors += "Failed to build $($csproj_file.FullName) : $output"
65+ }
66+ } catch {
67+ # Capture detailed error information
68+ $errorMessage = "Error building $($sqlproj_file.FullName) : $($_.Exception.Message)"
69+ Write-Host $errorMessage
70+ $errors += $errorMessage
71+ }
72+ }
73+ }
74+
75+ # Display all accumulated errors
76+ if ($errors.Count -gt 0) {
77+ Write-Host "SQL Project Build Errors:"
78+ $errors | ForEach-Object { Write-Host $_ }
79+ exit 1
80+ }
81+
82+ - name : Build Solution Excluding SQL Project
5783 run : |
58- # List all .csproj files except for .sqlproj
84+ # Enable strict error handling
85+ $ErrorActionPreference = 'Stop'
86+
87+ # Initialize an error collection
88+ $errors = @()
89+
90+ # List all .csproj files except .sqlproj
5991 $csproj_files = Get-ChildItem -Path . -Filter *.csproj -Recurse | Where-Object { $_.FullName -notmatch '\\.sqlproj$' }
60- # Build each .csproj file
61- foreach ($csproj_file in $csproj_files) {
62- Write-Host "Building $($csproj_file.FullName)"
63- dotnet build "$($csproj_file.FullName)"
64- }
92+
93+ if ($csproj_files.Count -eq 0) {
94+ $errors += "No .csproj files found."
95+ } else {
96+ foreach ($csproj_file in $csproj_files) {
97+ Write-Host "Building $($csproj_file.FullName)"
98+ try {
99+ $output = &dotnet build "$($csproj_file.FullName)" --configuration Release 2>&1
100+ if (!$?) {
101+ $errors += "Failed to build $($csproj_file.FullName) : $output"
102+ }
103+ } catch {
104+ # Capture detailed error information
105+ $errorMessage = "Error building $($csproj_file.FullName) : $($_.Exception.Message)"
106+ Write-Host $errorMessage
107+ $errors += $errorMessage
108+ }
109+ }
110+ }
65111
112+ # Display all accumulated errors
113+ if ($errors.Count -gt 0) {
114+ Write-Host "Solution Build Errors:"
115+ $errors | ForEach-Object { Write-Host $_ }
116+ exit 1
117+ }
118+
66119 # - name: Test
67120 # run: dotnet test ${{ env.BuildParameters.TestProjects }}
68121
0 commit comments