$ErrorActionPreference = 'Stop' $root = Split-Path -Parent $PSScriptRoot $publish = Join-Path $root 'artifacts\launcher' dotnet publish (Join-Path $PSScriptRoot 'launcher\QInventor.Launcher.csproj') -c Release -r win-x64 -o $publish --nologo if ($LASTEXITCODE -ne 0) { throw 'Не удалось собрать программу запуска QInventor.' } $builtLauncher = Join-Path $publish 'QInventor.exe' $installedLauncher = Join-Path $root 'QInventor.exe' # A running CAD session locks the launcher on Windows. An identical rebuild # needs no replacement and can still be packaged while that session is open. if (-not (Test-Path -LiteralPath $installedLauncher) -or (Get-FileHash -LiteralPath $builtLauncher).Hash -ne (Get-FileHash -LiteralPath $installedLauncher).Hash) { Copy-Item -LiteralPath $builtLauncher -Destination $installedLauncher -Force } Write-Host 'QInventor.exe готов к запуску.'