-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpublish_portable_x86.ps1
More file actions
49 lines (41 loc) · 1.68 KB
/
Copy pathpublish_portable_x86.ps1
File metadata and controls
49 lines (41 loc) · 1.68 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
# publish_portable_x86.ps1
# This script generates a portable, single-file, self-contained executable for Daily Prayer Time (Native) - 32-bit.
$Version = "2.9.1" # Should match csproj
$Runtime = "win-x86"
$ProjectDir = "./DailyPrayerTime.Native"
$OutputDir = "./Output/Portable"
Write-Host "🚀 Building Portable Version v$Version ($Runtime)..." -ForegroundColor Cyan
# Ensure output directory exists
if (-not (Test-Path $OutputDir)) {
New-Item -ItemType Directory -Force $OutputDir | Out-Null
}
$TargetExe = Join-Path $OutputDir "DailyPrayerTimer_v$($Version)_Portable_x86.exe"
if (Test-Path $TargetExe) {
Remove-Item -Force $TargetExe
}
# Publish the application
dotnet publish $ProjectDir `
-c Release `
-r $Runtime `
--self-contained true `
-p:PublishSingleFile=true `
-p:PublishReadyToRun=true `
-p:IncludeNativeLibrariesForSelfExtract=true `
-o $OutputDir
# Rename the output to include version and architecture
$OldExe = Join-Path $OutputDir "DailyPrayerTime.Native.exe"
if (Test-Path $OldExe) {
$NewName = "DailyPrayerTimer_v$($Version)_Portable_x86.exe"
Rename-Item -Path $OldExe -NewName $NewName
$FinalPath = Join-Path $OutputDir $NewName
Write-Host "✅ Created: $FinalPath" -ForegroundColor Green
# Create the .portable flag file
$FlagFile = Join-Path $OutputDir ".portable"
New-Item -ItemType File $FlagFile -Force | Out-Null
Write-Host "✅ Created .portable flag file" -ForegroundColor Green
} else {
Write-Host "❌ Error: Executable not found at $OldExe" -ForegroundColor Red
exit 1
}
Write-Host "`n🎉 Portable Build Complete!" -ForegroundColor Green
Write-Host "Stored in: $OutputDir" -ForegroundColor Yellow