#Requires -Version 5.1 param([switch]$SkipBuild) $ErrorActionPreference = "Stop" $root = Resolve-Path (Join-Path $PSScriptRoot "..") Set-Location $root Write-Host "Root: $root" -ForegroundColor Cyan $iscc = @( "$env:LocalAppData\Programs\Inno Setup 6\ISCC.exe", "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe", "${env:ProgramFiles}\Inno Setup 6\ISCC.exe" ) | Where-Object { Test-Path $_ } | Select-Object -First 1 if (-not $iscc) { throw "Inno Setup 6 (ISCC.exe) не найден. Установите: winget install JRSoftware.InnoSetup" } if (-not $SkipBuild) { Write-Host "Сборка Release..." -ForegroundColor Cyan dotnet build "src\ElectronicPharmacy\ElectronicPharmacy.csproj" -c Release if ($LASTEXITCODE -ne 0) { throw "Сборка приложения завершилась с ошибкой" } } Write-Host "Сборка установщика..." -ForegroundColor Cyan & $iscc "installer\ElfisaPharmacy.iss" if ($LASTEXITCODE -ne 0) { throw "Inno Setup завершился с ошибкой" } $out = Get-ChildItem "installer\output\ElfisaPharmacy-Setup-*.exe" | Where-Object { $_.Name -notmatch '\.bak\.' -and $_.Name -ne 'ElfisaPharmacy-Setup.exe' } | Sort-Object LastWriteTime -Descending | Select-Object -First 1 if (-not $out) { throw "Не найден собранный Setup exe в installer\output" } # Стабильное имя для CDN: https://cdn.24pharmdata.ru/ElfisaPharmacy-Setup.exe $stable = Join-Path $out.DirectoryName "ElfisaPharmacy-Setup.exe" Copy-Item $out.FullName $stable -Force Write-Host "" Write-Host "Готово: $($out.FullName)" -ForegroundColor Green Write-Host "CDN-файл: $stable" -ForegroundColor Green Write-Host ("Размер: {0:N1} МБ" -f ($out.Length / 1MB)) Write-Host "" Write-Host "Залейте на CDN:" -ForegroundColor Cyan Write-Host " https://cdn.24pharmdata.ru/ <- корень отдаёт этот Setup" Write-Host " или файл: ElfisaPharmacy-Setup.exe"