$ErrorActionPreference = "Stop" $dotnet = "C:\Program Files\dotnet\dotnet.exe" $root = $PSScriptRoot Write-Host "Stopping ClassNotifyService and Client..." -ForegroundColor Cyan Stop-Service ClassNotifyService -Force -ErrorAction SilentlyContinue Get-Process ClassNotify.Client -ErrorAction SilentlyContinue | Stop-Process -Force Start-Sleep -Seconds 1 Write-Host "Publishing Service to C:\Program Files\ClassNotify\Service..." -ForegroundColor Cyan & $dotnet publish "$root\src\Windows\ClassNotify.Service\ClassNotify.Service.csproj" -c Release -r win-x64 --self-contained true -o "C:\Program Files\ClassNotify\Service" Write-Host "Publishing Client to C:\Program Files\ClassNotify\Client..." -ForegroundColor Cyan & $dotnet publish "$root\src\Windows\ClassNotify.Client\ClassNotify.Client.csproj" -c Release -r win-x64 --self-contained true -o "C:\Program Files\ClassNotify\Client" if (Test-Path "C:\Program Files\ClassNotify\Client\runtimes\win\lib\net8.0\System.Speech.dll") { Copy-Item "C:\Program Files\ClassNotify\Client\runtimes\win\lib\net8.0\System.Speech.dll" "C:\Program Files\ClassNotify\Client\System.Speech.dll" -Force } Write-Host "Starting ClassNotifyService..." -ForegroundColor Cyan Start-Service ClassNotifyService Start-Sleep -Seconds 3 Get-Service ClassNotifyService Get-Process ClassNotify.Service, ClassNotify.Client -ErrorAction SilentlyContinue | Select-Object Id, ProcessName, SessionId, StartTime