-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild-InnoSetup.ps1
More file actions
130 lines (108 loc) · 4.19 KB
/
Copy pathBuild-InnoSetup.ps1
File metadata and controls
130 lines (108 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Builds an Inno Setup installer for EntityClassGenerator.
.DESCRIPTION
Creates a traditional Windows installer (.exe) with:
- Start Menu shortcuts
- Desktop icon (optional)
- Uninstaller
- Silent installation support
.PARAMETER InnoSetupPath
Path to ISCC.exe (Inno Setup compiler). If not provided, searches common locations.
.EXAMPLE
.\Build-InnoSetup.ps1
.\Build-InnoSetup.ps1 -InnoSetupPath "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
#>
[CmdletBinding()]
param(
[Parameter()]
[string]$InnoSetupPath
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
# Colors
function Write-Header { Write-Host "`n=== $args ===" -ForegroundColor Cyan }
function Write-Success { Write-Host "✅ $args" -ForegroundColor Green }
function Write-Warning { Write-Host "⚠️ $args" -ForegroundColor Yellow }
function Write-Failure { Write-Host "❌ $args" -ForegroundColor Red }
try {
Write-Header "Building Entity Class Generator - Inno Setup Installer"
# Find Inno Setup compiler
if (-not $InnoSetupPath) {
$searchPaths = @(
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
"${env:ProgramFiles}\Inno Setup 6\ISCC.exe",
"${env:ProgramFiles(x86)}\Inno Setup 5\ISCC.exe",
"${env:ProgramFiles}\Inno Setup 5\ISCC.exe"
)
foreach ($path in $searchPaths) {
if (Test-Path $path) {
$InnoSetupPath = $path
break
}
}
}
if (-not $InnoSetupPath -or -not (Test-Path $InnoSetupPath)) {
Write-Failure "Inno Setup compiler (ISCC.exe) not found."
Write-Host ""
Write-Host "Please install Inno Setup 6.x from:" -ForegroundColor Yellow
Write-Host " https://jrsoftware.org/isdl.php" -ForegroundColor Cyan
Write-Host ""
Write-Host "After installation, run this script again." -ForegroundColor Yellow
exit 1
}
Write-Success "Found Inno Setup at: $InnoSetupPath"
# Paths
$rootDir = $PSScriptRoot
$scriptPath = Join-Path $rootDir "packaging\innosetup\installer.iss"
$portableDir = Join-Path $rootDir "publish\portable-win-x64"
# Check if portable build exists
if (-not (Test-Path $portableDir)) {
Write-Warning "Portable build not found. Building portable version first..."
& (Join-Path $rootDir "Build-Portable.ps1")
if ($LASTEXITCODE -ne 0) {
throw "Portable build failed"
}
}
# Compile installer
Write-Header "Compiling Inno Setup installer"
$isccArgs = @(
$scriptPath,
"/O+", # Enable output overwrite
"/Qp" # Quiet with progress
)
& $InnoSetupPath @isccArgs
if ($LASTEXITCODE -ne 0) {
throw "Inno Setup compilation failed with exit code $LASTEXITCODE"
}
Write-Success "Installer compiled successfully"
# Find the output file
$installerPath = Join-Path $rootDir "publish\EntityClassGenerator-v1.0.0-Setup.exe"
if (-not (Test-Path $installerPath)) {
throw "Installer file not found at expected location: $installerPath"
}
# Calculate size
$installerSize = (Get-Item $installerPath).Length / 1MB
# Summary
Write-Header "Build Complete"
Write-Host ""
Write-Host " 📦 Installer: " -NoNewline
Write-Host "$installerPath" -ForegroundColor Cyan
Write-Host " 📊 Installer Size: " -NoNewline
Write-Host ("{0:N2} MB" -f $installerSize) -ForegroundColor Yellow
Write-Host ""
Write-Host " ℹ️ Installation Features:" -ForegroundColor Cyan
Write-Host " ✅ Start Menu shortcuts" -ForegroundColor Gray
Write-Host " ✅ Optional desktop icon" -ForegroundColor Gray
Write-Host " ✅ Uninstaller included" -ForegroundColor Gray
Write-Host " ✅ Silent installation support (/SILENT or /VERYSILENT)" -ForegroundColor Gray
Write-Host " ✅ Per-user installation (no admin required)" -ForegroundColor Gray
Write-Host ""
Write-Success "Inno Setup installer ready for deployment!"
Write-Host ""
} catch {
Write-Failure "Build failed: $_"
Write-Host $_.ScriptStackTrace -ForegroundColor Red
exit 1
}