인스톨러와 dist 패키징을 거치지 않고 AxCopilot.csproj만 Release + win-x64로 빌드해 src\AxCopilot\bin\Release\net8.0-windows10.0.17763.0\win-x64 출력물을 빠르게 갱신할 수 있도록 build-quick.ps1를 추가했습니다. 스크립트는 기본적으로 --no-restore 경로를 사용하고, 필요할 때만 -Restore를 수행하며, 잠금 대응용 -StopRunningApp과 정리용 -Clean 옵션을 함께 제공합니다. 검증: powershell -ExecutionPolicy Bypass -File .\build-quick.ps1 실행 성공, dotnet build src/AxCopilot/AxCopilot.csproj -c Release -r win-x64 경고 0 / 오류 0
100 lines
2.9 KiB
PowerShell
100 lines
2.9 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[switch]$Restore,
|
|
[switch]$Clean,
|
|
[switch]$StopRunningApp
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$project = Join-Path $root "src\AxCopilot\AxCopilot.csproj"
|
|
$assetsFile = Join-Path $root "src\AxCopilot\obj\project.assets.json"
|
|
$configuration = "Release"
|
|
$runtime = "win-x64"
|
|
$targetFramework = "net8.0-windows10.0.17763.0"
|
|
$output = Join-Path $root "src\AxCopilot\bin\$configuration\$targetFramework\$runtime"
|
|
|
|
function Invoke-Dotnet {
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string[]]$Arguments
|
|
)
|
|
|
|
Write-Host ("dotnet " + ($Arguments -join " ")) -ForegroundColor DarkGray
|
|
& dotnet @Arguments
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "dotnet command failed with exit code $LASTEXITCODE."
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " AX Copilot - Quick Build (Windows)" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
if (-not (Test-Path $project)) {
|
|
throw "Project file not found: $project"
|
|
}
|
|
|
|
if ($StopRunningApp) {
|
|
$running = Get-Process -Name "AxCopilot" -ErrorAction SilentlyContinue
|
|
if ($running) {
|
|
Write-Host "[0/3] Stopping running AxCopilot.exe..." -ForegroundColor Yellow
|
|
$running | Stop-Process -Force
|
|
}
|
|
}
|
|
|
|
if ($Clean) {
|
|
Write-Host "[1/3] Cleaning previous quick-build output..." -ForegroundColor Yellow
|
|
Invoke-Dotnet -Arguments @(
|
|
"clean", $project,
|
|
"-c", $configuration,
|
|
"-r", $runtime,
|
|
"--nologo",
|
|
"-v", "minimal"
|
|
)
|
|
}
|
|
|
|
$shouldRestore = $Restore -or -not (Test-Path $assetsFile)
|
|
if ($shouldRestore) {
|
|
Write-Host "[2/3] Restoring NuGet packages..." -ForegroundColor Yellow
|
|
Invoke-Dotnet -Arguments @(
|
|
"restore", $project,
|
|
"-r", $runtime,
|
|
"--nologo",
|
|
"-v", "minimal"
|
|
)
|
|
}
|
|
|
|
Write-Host "[3/3] Building AxCopilot only (no installer, no publish)..." -ForegroundColor Yellow
|
|
$buildArgs = @(
|
|
"build", $project,
|
|
"-c", $configuration,
|
|
"-r", $runtime,
|
|
"--nologo",
|
|
"-v", "minimal",
|
|
"-m",
|
|
"-p:RunAnalyzersDuringBuild=false"
|
|
)
|
|
|
|
if (-not $shouldRestore) {
|
|
$buildArgs += "--no-restore"
|
|
}
|
|
|
|
Invoke-Dotnet -Arguments $buildArgs
|
|
|
|
Write-Host ""
|
|
Write-Host "========================================" -ForegroundColor Green
|
|
Write-Host " Quick Build Complete" -ForegroundColor Green
|
|
Write-Host "========================================" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host ("Output: " + $output) -ForegroundColor Green
|
|
Write-Host "Skipped: installer, dist packaging, obfuscation, publish bundle" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Examples:" -ForegroundColor Cyan
|
|
Write-Host " .\build-quick.ps1"
|
|
Write-Host " .\build-quick.ps1 -StopRunningApp"
|
|
Write-Host " .\build-quick.ps1 -Restore -Clean"
|