fix build parallelo + rimozione sln duplicata

This commit is contained in:
Samuele Locatelli
2026-05-22 11:21:41 +02:00
parent f53eb87bbc
commit eaa04afb5c
2 changed files with 94 additions and 31 deletions
-31
View File
@@ -1,31 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOB-WIN-NEXT", "IOB-WIN-NEXT.csproj", "{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|x86.ActiveCfg = Debug|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Debug|x86.Build.0 = Debug|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|Any CPU.Build.0 = Release|Any CPU
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|x86.ActiveCfg = Release|x86
{B2ABB009-C046-4F9C-956C-52DCAA9FE5A9}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5BF50E92-A90E-4117-812C-2BFC803594DB}
EndGlobalSection
EndGlobal
+94
View File
@@ -0,0 +1,94 @@
# --- CONFIGURAZIONE ---
$pattern = "IOB-WIN-*.sln"
# Sostituisci questo percorso con il file .csproj del tuo progetto comune condiviso!
$sharedProjectPath = ".\IOB-WIN-FORM\IOB-WIN-FORM.csproj"
# Cerca tutte le soluzioni
$solutions = Get-ChildItem -Path . -Filter $pattern -Recurse
if ($solutions.Count -eq 0) {
Write-Host "⚠️ Nessuna soluzione trovata che corrisponde al pattern: $pattern" -ForegroundColor Yellow
Exit
}
Write-Host "🚀 Trovate $($solutions.Count) soluzioni." -ForegroundColor Magenta
# FASE 1: Compilazione preventiva del progetto comune
if (Test-Path $sharedProjectPath) {
Write-Host "`n📦 Fase 1: Compilazione del progetto comune condiviso..." -ForegroundColor Cyan
dotnet build $sharedProjectPath --configuration Debug
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Errore critico: Impossibile compilare il progetto comune. Interruzione." -ForegroundColor Red
Exit
}
Write-Host "✅ Progetto comune pronto." -ForegroundColor Green
}
else {
Write-Host "⚠️ Attenzione: Percorso del progetto comune non trovato nello script ($sharedProjectPath)." -ForegroundColor Yellow
Write-Host "Il parallelismo potrebbe causare conflitti di file." -ForegroundColor Yellow
}
# FASE 2: Compilazione parallela delle soluzioni senza toccare le dipendenze esterne
Write-Host "`n🛠️ Fase 2: Avvio compilazione parallela delle soluzioni (Max 4)..." -ForegroundColor Magenta
Write-Host "==================================================" -ForegroundColor Magenta
$results = $solutions | ForEach-Object -Parallel {
$solName = $_.Name
$solPath = $_.FullName
$sharedExists = $using:sharedProjectPath
# Se abbiamo compilato prima il progetto comune, usiamo --no-dependencies per evitare lock sui file
if ($sharedExists) {
$log = dotnet build $solPath --configuration Debug --no-dependencies 2>&1
}
else {
$log = dotnet build $solPath --configuration Debug 2>&1
}
[PSCustomObject]@{
Name = $solName
Success = ($LASTEXITCODE -eq 0)
Log = $log
}
} -ThrottleLimit 4
# --- ELABORAZIONE DEI RISULTATI ---
$successCount = 0
$failCount = 0
$failedSolutions = @()
foreach ($res in $results) {
if ($res.Success) {
Write-Host "$($res.Name) compilata con successo!" -ForegroundColor Green
$successCount++
}
else {
Write-Host "❌ Errore nella compilazione di $($res.Name)" -ForegroundColor Red
$failCount++
$failedSolutions += $res.Name
Write-Host "--- Dettagli Errore per $($res.Name) ---" -ForegroundColor DarkRed
$res.Log | Select-Object -Last 10 | Write-Host -ForegroundColor Gray
Write-Host "---------------------------------------" -ForegroundColor DarkRed
}
}
$failColor = if ($failCount -gt 0) { "Red" } else { "Gray" }
# --- RIEPILOGO FINALE ---
Write-Host "`n==================================================" -ForegroundColor Magenta
Write-Host "🏁 Processo di verifica completato!" -ForegroundColor Magenta
Write-Host "==================================================" -ForegroundColor Magenta
Write-Host " Successi: $successCount" -ForegroundColor Green
Write-Host " Falliti: $failCount" -ForegroundColor $failColor
if ($failCount -gt 0) {
Write-Host "`n❌ Elenco delle soluzioni fallite:" -ForegroundColor Red
foreach ($failed in $failedSolutions) {
Write-Host " - $failed" -ForegroundColor Red
}
}
else {
Write-Host "`n🎉 Ottimo! Tutte le soluzioni sono state verificate con successo." -ForegroundColor Green
}
Write-Host "==================================================" -ForegroundColor Magenta