Repository navigation
Expand file tree
/
Copy pathbuild.ps1
More file actions
66 lines (55 loc) · 2.32 KB
/
Copy pathbuild.ps1
File metadata and controls
66 lines (55 loc) · 2.32 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
#Requires -Version 5.1
<#
.SYNOPSIS
Publishes the ParentalControl projects and builds the Inno Setup installer.
.DESCRIPTION
1. Publishes ParentalControl.Service and ParentalControl.Admin as self-contained win-x64.
2. Invokes the Inno Setup compiler to produce ParentalControlSetup.exe.
.PARAMETER InnoSetupPath
Path to iscc.exe. Defaults to the standard Inno Setup 6 install location.
.PARAMETER Configuration
Build configuration. Defaults to Release.
#>
param(
[string]$InnoSetupPath = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
[string]$Configuration = "Release"
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$repoRoot = $PSScriptRoot
$srcDir = Join-Path $repoRoot "src"
$publishDir = Join-Path $repoRoot "publish"
$issFile = Join-Path $repoRoot "installer\ParentalControl.iss"
# Verify Inno Setup is installed
if (-not (Test-Path $InnoSetupPath)) {
Write-Error "Inno Setup compiler not found at '$InnoSetupPath'. Install from https://jrsoftware.org/isdownload.php or pass -InnoSetupPath."
exit 1
}
# Clean previous publish output
if (Test-Path $publishDir) {
Write-Host "Cleaning previous publish output..." -ForegroundColor Yellow
Remove-Item $publishDir -Recurse -Force
}
# Publish Service
Write-Host "`n=== Publishing ParentalControl.Service ===" -ForegroundColor Cyan
dotnet publish "$srcDir\ParentalControl.Service\ParentalControl.Service.csproj" `
--configuration $Configuration `
--runtime win-x64 `
--self-contained true `
--output "$publishDir\service"
if ($LASTEXITCODE -ne 0) { Write-Error "Service publish failed."; exit 1 }
# Publish Admin
Write-Host "`n=== Publishing ParentalControl.Admin ===" -ForegroundColor Cyan
dotnet publish "$srcDir\ParentalControl.Admin\ParentalControl.Admin.csproj" `
--configuration $Configuration `
--runtime win-x64 `
--self-contained true `
--output "$publishDir\admin"
if ($LASTEXITCODE -ne 0) { Write-Error "Admin publish failed."; exit 1 }
# Build Installer
Write-Host "`n=== Building Installer ===" -ForegroundColor Cyan
& $InnoSetupPath $issFile
if ($LASTEXITCODE -ne 0) { Write-Error "Inno Setup compilation failed."; exit 1 }
$outputExe = Join-Path $repoRoot "installer\Output\ParentalControlSetup.exe"
Write-Host "`n=== Build Complete ===" -ForegroundColor Green
Write-Host "Installer: $outputExe"