param(
    [string]$Configuration = "Release",
    [string]$Output = ".\publish\win-x64",
    [switch]$SelfContained
)

$ErrorActionPreference = "Stop"

$projectPath = Join-Path $PSScriptRoot "..\QYZH.InteractiveMagazine.PrintWorker.csproj"
$publishArgs = @(
    "publish",
    $projectPath,
    "-c", $Configuration,
    "-r", "win-x64",
    "-o", $Output
)

if ($SelfContained) {
    $publishArgs += "--self-contained"
    $publishArgs += "true"
} else {
    $publishArgs += "--self-contained"
    $publishArgs += "false"
}

dotnet @publishArgs

Write-Host "PrintWorker published to: $Output"
