26 lines
1.3 KiB
PowerShell
26 lines
1.3 KiB
PowerShell
param(
|
|
[string]$Runtime = 'win-x64',
|
|
[switch]$FrameworkDependent
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$projectRoot = Split-Path $PSScriptRoot -Parent
|
|
$outputDirectory = Join-Path $projectRoot "bin/desktop-$Runtime"
|
|
$selfContained = if ($FrameworkDependent) { 'false' } else { 'true' }
|
|
Push-Location (Join-Path $projectRoot 'desktop')
|
|
try {
|
|
dotnet publish Ads.Desktop -c Release -r $Runtime --self-contained $selfContained -o $outputDirectory --nologo
|
|
if ($LASTEXITCODE -ne 0) { throw 'Desktop publish failed' }
|
|
} finally { Pop-Location }
|
|
$suffix = if ($Runtime.StartsWith('win-')) { '.exe' } else { '' }
|
|
$client = Join-Path $projectRoot ('bin/ads-client' + $suffix)
|
|
if (Test-Path -LiteralPath $client) {
|
|
Copy-Item -LiteralPath $client -Destination (Join-Path $outputDirectory ('ads-client' + $suffix)) -Force
|
|
}
|
|
if ($Runtime.StartsWith('win-') -and (Test-Path -LiteralPath (Join-Path $projectRoot 'bin/tools/scrcpy/scrcpy.exe'))) {
|
|
$tools = Join-Path $outputDirectory 'tools/scrcpy'
|
|
New-Item -ItemType Directory -Force -Path $tools | Out-Null
|
|
Copy-Item -Path (Join-Path $projectRoot 'bin/tools/scrcpy/*') -Destination $tools -Recurse -Force
|
|
}
|
|
# Do not copy client.env or any other credential into a distributable directory.
|
|
Write-Host "Desktop published to $outputDirectory (credentials excluded)"
|