-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
140 lines (117 loc) · 5.13 KB
/
build.ps1
File metadata and controls
140 lines (117 loc) · 5.13 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
131
132
133
134
135
136
137
138
139
140
# VybeShift - Build & Package Script
# Run: Right-click -> Run with PowerShell (or: powershell -ExecutionPolicy Bypass -File build.ps1)
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
$dotnet = "C:\Program Files\dotnet\dotnet.exe"
$iscc = ""
Write-Host ""
Write-Host "============================================" -ForegroundColor Cyan
Write-Host " VybeShift - Build and Package " -ForegroundColor Cyan
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""
# -- Step 1: Check .NET 8 SDK ---------------------------------
Write-Host "[1/4] Checking .NET 8 SDK..." -ForegroundColor Yellow
if (-not (Test-Path $dotnet)) {
Write-Host " MISSING: .NET SDK not installed." -ForegroundColor Red
Write-Host " Opening download page..." -ForegroundColor White
Start-Process "https://dotnet.microsoft.com/en-us/download/dotnet/8.0"
Write-Host " --> Install .NET 8 SDK (x64), then re-run this script." -ForegroundColor Cyan
Read-Host "Press Enter to exit"
exit 1
}
$sdks = & $dotnet --list-sdks 2>&1
if ($sdks -notmatch "8\.") {
Write-Host " MISSING: .NET 8 SDK not found." -ForegroundColor Red
Write-Host " Installed SDKs: $sdks" -ForegroundColor Gray
Write-Host " Opening download page..." -ForegroundColor White
Start-Process "https://dotnet.microsoft.com/en-us/download/dotnet/8.0"
Read-Host "Press Enter to exit"
exit 1
}
Write-Host " OK: .NET 8 SDK found" -ForegroundColor Green
# -- Step 2: Check Inno Setup ---------------------------------
Write-Host "[2/4] Checking Inno Setup 6..." -ForegroundColor Yellow
$innoPaths = @(
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
"C:\Program Files\Inno Setup 6\ISCC.exe"
)
foreach ($p in $innoPaths) { if (Test-Path $p) { $iscc = $p; break } }
if (-not $iscc) {
Write-Host " MISSING: Inno Setup 6 not installed." -ForegroundColor Red
Write-Host " Opening download page..." -ForegroundColor White
Start-Process "https://jrsoftware.org/isdl.php"
Write-Host " --> Install Inno Setup 6, then re-run this script." -ForegroundColor Cyan
Read-Host "Press Enter to exit"
exit 1
}
Write-Host " OK: Inno Setup found at: $iscc" -ForegroundColor Green
# -- Step 3: Check VB-Cable -----------------------------------
Write-Host "[3/4] Checking assets..." -ForegroundColor Yellow
$vbCable = Join-Path $root "installer\drivers\VBCABLE_Setup_x64.exe"
if (Test-Path $vbCable) {
Write-Host " OK: VB-Cable bundled" -ForegroundColor Green
} else {
Write-Host " WARN: VB-Cable not found in installer\drivers\" -ForegroundColor Yellow
Write-Host " Users will be told to download it manually." -ForegroundColor Gray
}
$mp3 = Join-Path $root "installer\assets\Digital_Genesis.mp3"
if (Test-Path $mp3) {
Write-Host " OK: Installer music found" -ForegroundColor Green
} else {
Write-Host " WARN: Digital_Genesis.mp3 not found in installer\assets\" -ForegroundColor Yellow
}
$logo = Join-Path $root "installer\assets\logo.png"
if (Test-Path $logo) {
Write-Host " OK: Logo found" -ForegroundColor Green
} else {
Write-Host " WARN: logo.png not found in installer\assets\" -ForegroundColor Yellow
}
# -- Step 4: Publish app --------------------------------------
Write-Host "[4/4] Publishing VybeShift (self-contained single EXE)..." -ForegroundColor Yellow
$publishDir = Join-Path $root "VybeShift.UI\bin\publish"
if (Test-Path $publishDir) {
Remove-Item $publishDir -Recurse -Force
}
$projFile = Join-Path $root "VybeShift.UI\VybeShift.UI.csproj"
& $dotnet publish $projFile `
--configuration Release `
--runtime win-x64 `
--self-contained true `
-p:PublishSingleFile=true `
-p:PublishReadyToRun=true `
-p:IncludeNativeLibrariesForSelfExtract=true `
-p:EnableCompressionInSingleFile=true `
--output $publishDir `
--nologo
if ($LASTEXITCODE -ne 0) {
Write-Host ""
Write-Host " ERROR: Publish failed. See errors above." -ForegroundColor Red
Read-Host "Press Enter to exit"
exit 1
}
Write-Host " OK: Published to: $publishDir" -ForegroundColor Green
# -- Step 5: Build installer ----------------------------------
Write-Host ""
Write-Host "[5/5] Building installer EXE..." -ForegroundColor Yellow
$outDir = Join-Path $root "installer\Output"
if (-not (Test-Path $outDir)) {
New-Item -ItemType Directory -Path $outDir | Out-Null
}
$issFile = Join-Path $root "installer\setup.iss"
& $iscc $issFile
if ($LASTEXITCODE -ne 0) {
Write-Host " ERROR: Inno Setup build failed." -ForegroundColor Red
Read-Host "Press Enter to exit"
exit 1
}
# -- Done -----------------------------------------------------
Write-Host ""
Write-Host "============================================" -ForegroundColor Green
Write-Host " BUILD COMPLETE!" -ForegroundColor Green
Write-Host ""
Write-Host " Installer: installer\Output\VybeShift_Setup_v1.0.0.exe" -ForegroundColor Green
Write-Host " Share this EXE with anyone - they just double-click." -ForegroundColor Green
Write-Host "============================================" -ForegroundColor Green
Write-Host ""
Start-Process explorer.exe -ArgumentList $outDir
Read-Host "Press Enter to exit"