@@ -28,11 +28,16 @@ Write-Host "====================================================="
2828Write-Host " Xcaciv.Loader Build Script"
2929Write-Host " ====================================================="
3030if ($Publish ) {
31- Write-Host " Mode: Publish (building for .NET 8.0 and .NET 10.0)" - ForegroundColor Cyan
31+ Write-Host " Mode: Publish" - ForegroundColor Cyan
32+ if ($UseNet10 ) {
33+ Write-Host " Target Frameworks: .NET 8.0 and .NET 10.0" - ForegroundColor Cyan
34+ } else {
35+ Write-Host " Target Framework: .NET 8.0 only" - ForegroundColor Cyan
36+ }
3237} elseif ($UseNet10 ) {
33- Write-Host " Target Framework: Both .NET 8.0 and .NET 10.0"
38+ Write-Host " Target Frameworks: .NET 8.0 and .NET 10.0"
3439} else {
35- Write-Host " Target Framework: .NET 8.0"
40+ Write-Host " Target Framework: .NET 8.0 only "
3641}
3742Write-Host " Run Tests: $ ( if ($Test ) { " Yes" } else { " No" } ) "
3843Write-Host " Local NuGet path: $LocalNugetPath "
@@ -43,28 +48,23 @@ if ($Publish) {
4348}
4449Write-Host " ====================================================="
4550
46- if ($Publish ) {
47- # Publish mode: Build for both .NET 8 and .NET 10
48- Write-Host " Building for .NET 8.0..." - ForegroundColor Cyan
49- $buildCommand = " dotnet build --configuration Release"
50- Write-Host " Executing: $buildCommand " - ForegroundColor Gray
51- Invoke-Expression $buildCommand
52-
53- if ($LASTEXITCODE -ne 0 ) {
54- Write-Host " Build failed for .NET 8.0 with exit code $LASTEXITCODE " - ForegroundColor Red
55- exit $LASTEXITCODE
56- }
57-
58- Write-Host " Building for .NET 10.0..." - ForegroundColor Cyan
51+ # Build
52+ Write-Host " Building solution..." - ForegroundColor Cyan
53+ if ($UseNet10 ) {
5954 $buildCommand = " dotnet build --configuration Release /p:UseNet10=true"
60- Write-Host " Executing: $buildCommand " - ForegroundColor Gray
61- Invoke-Expression $buildCommand
62-
63- if ($LASTEXITCODE -ne 0 ) {
64- Write-Host " Build failed for .NET 10.0 with exit code $LASTEXITCODE " - ForegroundColor Red
65- exit $LASTEXITCODE
66- }
67-
55+ } else {
56+ $buildCommand = " dotnet build --configuration Release"
57+ }
58+ Write-Host " Executing: $buildCommand " - ForegroundColor Gray
59+ Invoke-Expression $buildCommand
60+
61+ if ($LASTEXITCODE -ne 0 ) {
62+ Write-Host " Build failed with exit code $LASTEXITCODE " - ForegroundColor Red
63+ exit $LASTEXITCODE
64+ }
65+
66+ # If publishing, copy packages to publish directory
67+ if ($Publish ) {
6868 # Create publish directory
6969 $publishDir = Join-Path $PSScriptRoot " publish"
7070 if (Test-Path $publishDir ) {
@@ -97,7 +97,7 @@ if ($Publish) {
9797 Write-Host " Copied $copiedCount package(s) to publish directory" - ForegroundColor Green
9898 }
9999
100- # Mandatory local copy to NuGet packages directory (only if directory exists)
100+ # Copy to local NuGet packages directory
101101 if ([string ]::IsNullOrWhiteSpace($LocalNugetPath )) {
102102 Write-Host " Warning: LocalNugetPath is not specified, skipping local copy" - ForegroundColor Yellow
103103 } else {
@@ -126,99 +126,21 @@ if ($Publish) {
126126 exit 1
127127 }
128128 }
129-
130- } else {
131- # Standard build mode
132- if ($UseNet10 ) {
133- # Build for both .NET 8 and .NET 10
134- Write-Host " Building for .NET 8.0..." - ForegroundColor Cyan
135- $buildCommand = " dotnet build --configuration Release"
136- Write-Host " Executing: $buildCommand " - ForegroundColor Gray
137- Invoke-Expression $buildCommand
138-
139- if ($LASTEXITCODE -ne 0 ) {
140- Write-Host " Build failed for .NET 8.0 with exit code $LASTEXITCODE " - ForegroundColor Red
141- exit $LASTEXITCODE
142- }
143-
144- Write-Host " Building for .NET 10.0..." - ForegroundColor Cyan
145- $buildCommand = " dotnet build --configuration Release /p:UseNet10=true"
146- Write-Host " Executing: $buildCommand " - ForegroundColor Gray
147- Invoke-Expression $buildCommand
148-
149- if ($LASTEXITCODE -ne 0 ) {
150- Write-Host " Build failed for .NET 10.0 with exit code $LASTEXITCODE " - ForegroundColor Red
151- exit $LASTEXITCODE
152- }
153- } else {
154- # Build for .NET 8 only
155- Write-Host " Building solution..." - ForegroundColor Cyan
156- $buildCommand = " dotnet build --configuration Release"
157- Write-Host " Executing: $buildCommand " - ForegroundColor Gray
158- Invoke-Expression $buildCommand
159-
160- if ($LASTEXITCODE -ne 0 ) {
161- Write-Host " Build failed with exit code $LASTEXITCODE " - ForegroundColor Red
162- exit $LASTEXITCODE
163- }
164- }
165129}
166130
167131# Run tests if requested
168132if ($Test ) {
169- if ($Publish ) {
170- # Run tests for both frameworks
171- Write-Host " Running tests for .NET 8.0..." - ForegroundColor Cyan
172- $testCommand = " dotnet test --no-build --configuration Release"
173- Write-Host " Executing: $testCommand " - ForegroundColor Gray
174- Invoke-Expression $testCommand
175-
176- if ($LASTEXITCODE -ne 0 ) {
177- Write-Host " Tests failed for .NET 8.0 with exit code $LASTEXITCODE " - ForegroundColor Red
178- exit $LASTEXITCODE
179- }
180-
181- Write-Host " Running tests for .NET 10.0..." - ForegroundColor Cyan
182- $testCommand = " dotnet test --no-build --configuration Release /p:UseNet10=true"
183- Write-Host " Executing: $testCommand " - ForegroundColor Gray
184- Invoke-Expression $testCommand
185-
186- if ($LASTEXITCODE -ne 0 ) {
187- Write-Host " Tests failed for .NET 10.0 with exit code $LASTEXITCODE " - ForegroundColor Red
188- exit $LASTEXITCODE
189- }
190- } elseif ($UseNet10 ) {
191- # Run tests for both frameworks
192- Write-Host " Running tests for .NET 8.0..." - ForegroundColor Cyan
193- $testCommand = " dotnet test --no-build --configuration Release"
194- Write-Host " Executing: $testCommand " - ForegroundColor Gray
195- Invoke-Expression $testCommand
196-
197- if ($LASTEXITCODE -ne 0 ) {
198- Write-Host " Tests failed for .NET 8.0 with exit code $LASTEXITCODE " - ForegroundColor Red
199- exit $LASTEXITCODE
200- }
201-
202- Write-Host " Running tests for .NET 10.0..." - ForegroundColor Cyan
203- $testCommand = " dotnet test --no-build --configuration Release /p:UseNet10=true"
204- Write-Host " Executing: $testCommand " - ForegroundColor Gray
205- Invoke-Expression $testCommand
206-
207- if ($LASTEXITCODE -ne 0 ) {
208- Write-Host " Tests failed for .NET 10.0 with exit code $LASTEXITCODE " - ForegroundColor Red
209- exit $LASTEXITCODE
210- }
211- } else {
212- # Standard test mode (.NET 8 only)
213- Write-Host " Running tests..." - ForegroundColor Cyan
214- $testCommand = " dotnet test --no-build --configuration Release"
215- Write-Host " Executing: $testCommand " - ForegroundColor Gray
216- Invoke-Expression $testCommand
217-
218- if ($LASTEXITCODE -ne 0 ) {
219- Write-Host " Tests failed with exit code $LASTEXITCODE " - ForegroundColor Red
220- exit $LASTEXITCODE
221- }
133+ Write-Host " Running tests..." - ForegroundColor Cyan
134+ $testCommand = " dotnet test --no-build --configuration Release"
135+ if ($UseNet10 ) {
136+ $testCommand += " /p:UseNet10=true"
137+ }
138+ Write-Host " Executing: $testCommand " - ForegroundColor Gray
139+ Invoke-Expression $testCommand
140+
141+ if ($LASTEXITCODE -ne 0 ) {
142+ Write-Host " Tests failed with exit code $LASTEXITCODE " - ForegroundColor Red
143+ exit $LASTEXITCODE
222144 }
223145}
224146
@@ -271,16 +193,15 @@ if ($Publish) {
271193 }
272194}
273195
196+ # Final summary
197+ Write-Host " ====================================================="
274198if ($Publish ) {
275- Write-Host " ====================================================="
276199 Write-Host " Publish completed successfully!" - ForegroundColor Green
277200 Write-Host " Packages available in: $ ( Join-Path $PSScriptRoot ' publish' ) " - ForegroundColor Cyan
278201 if (-not [string ]::IsNullOrWhiteSpace($LocalNugetPath )) {
279202 Write-Host " Local packages copied to: $LocalNugetPath " - ForegroundColor Cyan
280203 }
281- Write-Host " ====================================================="
282204} else {
283- Write-Host " ====================================================="
284205 Write-Host " Build completed successfully!" - ForegroundColor Green
285- Write-Host " ===================================================== "
286- }
206+ }
207+ Write-Host " ===================================================== "
0 commit comments