You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
2.1 KiB

4 days ago
param(
[string]$ProductVersion = '1.0.3',
[string]$PublishDir = (Join-Path $PSScriptRoot '..\obj\setup-staging\app'),
[string]$OutputDir = (Join-Path $PSScriptRoot '..\obj\setup-staging\installer')
)
$ErrorActionPreference = 'Stop'
$wix = Join-Path $PSScriptRoot '..\obj\installer-tools\wix.exe'
if (-not (Test-Path -LiteralPath $wix)) { throw "WiX CLI not found: $wix" }
$PublishDir = (Resolve-Path -LiteralPath $PublishDir).Path
$migration = Join-Path $PSScriptRoot '..\add-resistance-column.sql'
if (-not (Test-Path -LiteralPath $migration -PathType Leaf)) { throw "Missing resistance migration: $migration" }
Copy-Item -LiteralPath $migration -Destination (Join-Path $PublishDir 'add-resistance-column.sql') -Force
foreach ($file in @('Housing.exe', 'Housing.dll', 'Housing.runtimeconfig.json', 'hostfxr.dll', 'coreclr.dll', 'PresentationFramework.dll', 'Hardware.ini', 'Database.ini', 'InspectionSettings.ini', 'LoginOptions.json', 'add-resistance-column.sql')) {
if (-not (Test-Path -LiteralPath (Join-Path $PublishDir $file) -PathType Leaf)) { throw "Missing publish file: $file" }
}
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
$output = Join-Path (Resolve-Path -LiteralPath $OutputDir).Path 'Housing.msi'
& $wix build (Join-Path $PSScriptRoot 'Housing.wxs') -arch x64 -d "PublishDir=$PublishDir" -d "ProductVersion=$ProductVersion" -o $output
if ($LASTEXITCODE -ne 0) { throw "WiX build failed (exit $LASTEXITCODE)." }
Write-Host "Unsigned installer: $output"
$bundle = Join-Path (Resolve-Path -LiteralPath $OutputDir).Path 'HousingSetup.exe'
$bal = Join-Path $PSScriptRoot '..\.wix\extensions\WixToolset.Bal.wixext\6.0.2\wixext6\WixToolset.BootstrapperApplications.wixext.dll'
if (-not (Test-Path -LiteralPath $bal)) { throw "WiX bootstrapper extension missing: $bal. MSI remains available at $output." }
& $wix build (Join-Path $PSScriptRoot 'Bundle.wxs') -arch x64 -ext $bal -d "MsiFile=$output" -d "ProductVersion=$ProductVersion" -o $bundle
if ($LASTEXITCODE -ne 0) { throw "WiX bundle build failed (exit $LASTEXITCODE). MSI remains available at $output." }
Write-Host "Unsigned installer: $bundle"