# ====================================================================== # build-installer.ps1 - Publiziert alle Projekte und erstellt den Installer # Aufruf: .\installer\build-installer.ps1 # ====================================================================== $ErrorActionPreference = "Stop" $root = Split-Path $PSScriptRoot -Parent Write-Host "" Write-Host "+----------------------------------------------+" -ForegroundColor Cyan Write-Host "| EngineeringSync Installer Build |" -ForegroundColor Cyan Write-Host "+----------------------------------------------+" -ForegroundColor Cyan Write-Host "" # -- 1. Service publizieren (self-contained) ------------------------------------------- Write-Host "[1/4] Publiziere Windows Service (self-contained)..." -ForegroundColor Yellow dotnet publish "$root\EngineeringSync.Service\EngineeringSync.Service.csproj" ` --configuration Release ` --runtime win-x64 ` --self-contained true ` -o "$root\EngineeringSync.Service\bin\Release\net10.0\publish" if ($LASTEXITCODE -ne 0) { throw "Service-Publish fehlgeschlagen" } Write-Host " [OK] Service publiziert (self-contained)" -ForegroundColor Green # -- 2. TrayApp publizieren (self-contained) ------------------------------------------- Write-Host "[2/4] Publiziere TrayApp (self-contained)..." -ForegroundColor Yellow dotnet publish "$root\EngineeringSync.TrayApp\EngineeringSync.TrayApp.csproj" ` --configuration Release ` --runtime win-x64 ` --self-contained true ` -o "$root\EngineeringSync.TrayApp\bin\Release\net10.0-windows\publish" if ($LASTEXITCODE -ne 0) { throw "TrayApp-Publish fehlgeschlagen" } Write-Host " [OK] TrayApp publiziert (self-contained)" -ForegroundColor Green # -- 3. Setup-Wizard publizieren (self-contained) -------------------------------------- Write-Host "[3/4] Publiziere Setup-Wizard..." -ForegroundColor Yellow dotnet publish "$root\EngineeringSync.Setup\EngineeringSync.Setup.csproj" ` --configuration Release ` --runtime win-x64 ` --self-contained true ` --output "$root\EngineeringSync.Setup\bin\Release\net10.0-windows\publish" if ($LASTEXITCODE -ne 0) { throw "Setup-Wizard-Publish fehlgeschlagen" } Write-Host " [OK] Setup-Wizard publiziert (self-contained)" -ForegroundColor Green # -- 4. Inno Setup ausfuehren ----------------------------------------- Write-Host "[4/4] Erstelle Installer mit Inno Setup..." -ForegroundColor Yellow $isccCmd = Get-Command "iscc" -ErrorAction SilentlyContinue $isccPaths = @( "C:\Program Files (x86)\Inno Setup 6\ISCC.exe", "C:\Program Files\Inno Setup 6\ISCC.exe", $(if ($isccCmd) { $isccCmd.Source } else { $null }) ) | Where-Object { $_ -and (Test-Path $_) } | Select-Object -First 1 if (-not $isccPaths) { Write-Host "" Write-Host " WARNUNG: Inno Setup nicht gefunden!" -ForegroundColor Red Write-Host " Bitte installieren: https://jrsoftware.org/isinfo.php" -ForegroundColor Red Write-Host "" Write-Host " Alternativ manuell kompilieren:" -ForegroundColor Yellow Write-Host " ISCC.exe ""$PSScriptRoot\setup.iss""" -ForegroundColor Yellow exit 1 } New-Item -ItemType Directory -Force -Path "$root\dist" | Out-Null & $isccPaths "$PSScriptRoot\setup.iss" if ($LASTEXITCODE -ne 0) { throw "Inno Setup fehlgeschlagen" } Write-Host "" Write-Host "+----------------------------------------------+" -ForegroundColor Green Write-Host "| [OK] Installer erfolgreich erstellt! |" -ForegroundColor Green Write-Host "+----------------------------------------------+" -ForegroundColor Green Write-Host "" Write-Host " Ausgabe: $root\dist" -ForegroundColor Cyan # Installer im Explorer oeffnen $distPath = "$root\dist" Start-Process "explorer.exe" $distPath