Working version
This commit is contained in:
+15
-4
@@ -4,22 +4,33 @@ $projectDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$ffmpeg = Join-Path $projectDir 'ThirdParty\ffmpeg.exe'
|
||||
$ffprobe = Join-Path $projectDir 'ThirdParty\ffprobe.exe'
|
||||
$releaseExe = Join-Path $projectDir 'bin\Release\net8.0-windows\win-x64\AmiReel.exe'
|
||||
$publishDir = Join-Path $projectDir 'bin\Release\net8.0-windows\win-x64\publish'
|
||||
$publishExe = Join-Path $publishDir 'AmiReel.exe'
|
||||
|
||||
if (-not (Test-Path $ffmpeg) -or -not (Test-Path $ffprobe)) {
|
||||
throw 'Add ffmpeg.exe and ffprobe.exe to ThirdParty before publishing.'
|
||||
}
|
||||
|
||||
if (Test-Path $releaseExe) {
|
||||
if ((Test-Path $releaseExe) -or (Test-Path $publishExe)) {
|
||||
$runningReleaseInstances = Get-Process AmiReel -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Path -and [string]::Equals($_.Path, $releaseExe, [System.StringComparison]::OrdinalIgnoreCase) }
|
||||
Where-Object {
|
||||
$_.Path -and (
|
||||
[string]::Equals($_.Path, $releaseExe, [System.StringComparison]::OrdinalIgnoreCase) -or
|
||||
[string]::Equals($_.Path, $publishExe, [System.StringComparison]::OrdinalIgnoreCase)
|
||||
)
|
||||
}
|
||||
|
||||
if ($runningReleaseInstances) {
|
||||
Write-Host 'Stopping running release build before publish...' -ForegroundColor Yellow
|
||||
Write-Host 'Stopping running AmiReel build before publish...' -ForegroundColor Yellow
|
||||
$runningReleaseInstances | Stop-Process -Force
|
||||
Start-Sleep -Milliseconds 500
|
||||
Start-Sleep -Milliseconds 800
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path $publishDir) {
|
||||
Remove-Item -LiteralPath $publishDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
dotnet publish (Join-Path $projectDir 'AmigaDB.VideoRenderer.csproj') `
|
||||
-c Release `
|
||||
-r win-x64 `
|
||||
|
||||
Reference in New Issue
Block a user