Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path $windowsDir = Join-Path $repoRoot "windows" $agentDir = Join-Path $repoRoot "agent" $windowsSolution = Join-Path $windowsDir "QuickIP.Client.sln" $agentLinuxOutput = Join-Path $agentDir "quickip-agent-linux-amd64" if (-not (Test-Path -LiteralPath $windowsSolution)) { throw "Windows solution not found: $windowsSolution" } if (-not (Test-Path -LiteralPath $agentDir)) { throw "Agent directory not found: $agentDir" } Write-Host "[1/3] Building Windows client (Debug)..." dotnet build $windowsSolution -c Debug $previousGoos = $env:GOOS $previousGoarch = $env:GOARCH $previousCgoEnabled = $env:CGO_ENABLED try { Write-Host "[2/2] Building agent for Linux amd64..." Set-Location -LiteralPath $agentDir $env:GOOS = "linux" $env:GOARCH = "amd64" $env:CGO_ENABLED = "0" go build -o $agentLinuxOutput ./cmd/quickip-agent } finally { $env:GOOS = $previousGoos $env:GOARCH = $previousGoarch $env:CGO_ENABLED = $previousCgoEnabled Set-Location -LiteralPath $repoRoot } Write-Host "Build completed." Write-Host "Windows client output: windows/QuickIP.Client/bin/Debug/net9.0-windows/" Write-Host "Agent Linux output: agent/quickip-agent-linux-amd64"