Files
Blueberry/build.installer.ps1
2025-12-10 10:59:48 +01:00

31 lines
1.4 KiB
PowerShell

# Configuration
$wpfProject = ".\BlueMine\BlueMine.csproj"
$installerProject = ".\BlueberryUpdater\BlueberryUpdater.csproj"
$installerDir = ".\BlueberryUpdater"
$zipPath = "$installerDir\AppPayload.zip"
$outputDir = ".\FinalBuild"
# 1. Clean up previous artifacts
Write-Host "Cleaning up..." -ForegroundColor Cyan
if (Test-Path $zipPath) { Remove-Item $zipPath }
if (Test-Path $outputDir) { Remove-Item $outputDir -Recurse }
if (Test-Path ".\TempWpfPublish") { Remove-Item ".\TempWpfPublish" -Recurse }
# 2. Publish WPF App (Self-Contained)
Write-Host "Publishing WPF App..." -ForegroundColor Cyan
dotnet publish $wpfProject -c Release -r win-x64 --self-contained true -o ".\TempWpfPublish" /p:DebugType=None /p:DebugSymbols=false
# 3. Zip the Published WPF App
Write-Host "Creating Payload Zip..." -ForegroundColor Cyan
Compress-Archive -Path ".\TempWpfPublish\*" -DestinationPath $zipPath
# 4. Publish Installer (Single File + Embeds the Zip)
Write-Host "Building Final Installer..." -ForegroundColor Cyan
dotnet publish $installerProject -c Release -r win-x64 --self-contained true -o $outputDir -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
# 5. Cleanup Temp Files
Remove-Item ".\TempWpfPublish" -Recurse
# Optional: Remove the zip from the source folder if you want to keep it clean
# Remove-Item $zipPath
Write-Host "Build Complete! Installer is in $outputDir" -ForegroundColor Green