-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
87 lines (72 loc) · 2.3 KB
/
build.ps1
File metadata and controls
87 lines (72 loc) · 2.3 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
# WinGet UI Manager - PowerShell Build Script
param(
[ValidateSet('Debug', 'Release')]
[string]$Configuration = 'Release',
[switch]$Run,
[switch]$Clean,
[switch]$Restore
)
Write-Host "========================================"
Write-Host "WinGet UI Manager v2.0 - Build Script"
Write-Host "========================================"
Write-Host ""
# Check if .NET SDK is installed
try {
$dotnetVersion = dotnet --version
Write-Host ".NET SDK found: $dotnetVersion"
} catch {
Write-Host "ERROR: .NET SDK is not installed or not in PATH" -ForegroundColor Red
Write-Host "Please install .NET 8.0 or later from https://dotnet.microsoft.com"
exit 1
}
Write-Host ""
Write-Host "Building WinGetUI in $Configuration mode..."
Write-Host ""
# Navigate to project directory
Push-Location "WinGetUI"
try {
# Clean if requested
if ($Clean -or $Restore) {
Write-Host "Cleaning previous builds..."
& dotnet clean --configuration $Configuration 2>$null
}
# Restore dependencies
Write-Host "Restoring NuGet packages..."
& dotnet restore
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Failed to restore packages" -ForegroundColor Red
exit 1
}
Write-Host ""
# Build the project
Write-Host "Building project..."
& dotnet build --configuration $Configuration --no-restore
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Build failed" -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "========================================"
Write-Host "Build completed successfully!"
Write-Host "========================================"
Write-Host ""
# Find the built executable
$executable = Get-ChildItem -Path "bin\$Configuration" -Filter "WinGetUI.exe" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
if ($executable) {
$fullPath = $executable.FullName
Write-Host "Output: $fullPath"
Write-Host ""
Write-Host "To run the application, execute:"
Write-Host "$fullPath"
if ($Run) {
Write-Host ""
Write-Host "Starting application..."
& $fullPath
}
} else {
Write-Host "Build output location: bin\$Configuration"
}
Write-Host ""
} finally {
Pop-Location
}