27 lines
1.3 KiB
PowerShell
27 lines
1.3 KiB
PowerShell
# Richtet den Windows-Autostart fuer Anrufmonitor ein (Release-Build + Verknuepfung im
|
|
# Startup-Ordner). Idempotent - kann nach jedem Update erneut ausgefuehrt werden.
|
|
$ErrorActionPreference = 'Stop'
|
|
$repoRoot = Split-Path $PSScriptRoot -Parent
|
|
$exePath = Join-Path $repoRoot "src\Anrufmonitor.App\bin\Release\net10.0-windows\Anrufmonitor.App.exe"
|
|
|
|
Write-Host "== Release-Build ==" -ForegroundColor Cyan
|
|
dotnet build (Join-Path $repoRoot "src\Anrufmonitor.App\Anrufmonitor.App.csproj") -c Release
|
|
|
|
if (-not (Test-Path $exePath)) {
|
|
throw "Build-Ausgabe nicht gefunden: $exePath"
|
|
}
|
|
|
|
$startupDir = [Environment]::GetFolderPath('Startup')
|
|
$shortcutPath = Join-Path $startupDir "Anrufmonitor.lnk"
|
|
|
|
Write-Host "== Autostart-Verknuepfung ==" -ForegroundColor Cyan
|
|
$shell = New-Object -ComObject WScript.Shell
|
|
$shortcut = $shell.CreateShortcut($shortcutPath)
|
|
$shortcut.TargetPath = $exePath
|
|
$shortcut.WorkingDirectory = Split-Path $exePath
|
|
$shortcut.Description = "Anrufmonitor - SIP Caller-ID"
|
|
$shortcut.Save()
|
|
|
|
Write-Host "Fertig: $shortcutPath -> $exePath" -ForegroundColor Green
|
|
Write-Host "Hinweis: appsettings.Local.json muss im Release-Ordner liegen (wird beim Build" -ForegroundColor Yellow
|
|
Write-Host " automatisch mitkopiert, falls sie in src\Anrufmonitor.App\ vorhanden ist)." -ForegroundColor Yellow
|