# GameLauncher 単一ファイル発行スクリプト # 公開先: Z:\自作ソフト\GameLauncher\ $ErrorActionPreference = 'Stop' $projectDir = $PSScriptRoot $publishDir = "Z:\自作ソフト\GameLauncher" Write-Host "=== GameLauncher 発行処理開始 (発行先: $publishDir) ===" -ForegroundColor Cyan if (!(Test-Path $publishDir)) { New-Item -ItemType Directory -Path $publishDir -Force | Out-Null } Write-Host "プロジェクトのビルドおよび単一ファイル発行中..." -ForegroundColor Yellow dotnet publish "$projectDir\GameLauncher.csproj" -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -o "$publishDir" if ($LASTEXITCODE -eq 0) { # プラグインおよび設定ファイルの配置 if (Test-Path "$projectDir\plugins") { if (!(Test-Path "$publishDir\plugins")) { New-Item -ItemType Directory -Path "$publishDir\plugins" -Force | Out-Null } Copy-Item -Path "$projectDir\plugins\*" -Destination "$publishDir\plugins" -Recurse -Force } if (Test-Path "$projectDir\Config.tjs") { Copy-Item -Path "$projectDir\Config.tjs" -Destination "$publishDir\Config.tjs" -Force } # エンジン別の外部ツール(Engines\\Tools 配下)を配置する。 # 各エンジンは自身のツールフォルダのみを参照するため、エンジン間で干渉しない。 $enginesRoot = Join-Path $projectDir "Engines" if (Test-Path $enginesRoot) { foreach ($engineDir in Get-ChildItem -Path $enginesRoot -Directory) { $srcTools = Join-Path $engineDir.FullName "Tools" if (Test-Path $srcTools) { $dstTools = Join-Path (Join-Path $publishDir "Engines") (Join-Path $engineDir.Name "Tools") if (!(Test-Path $dstTools)) { New-Item -ItemType Directory -Path $dstTools -Force | Out-Null } robocopy $srcTools $dstTools /E /NP /R:1 /W:1 | Out-Null } } } # Enigma Virtual Box (EVB) 用の解凍ツール(evbunpack.exe)はリポジトリ同梱(自動取得は行わない)。 # 未配置の場合は警告のみ出し、Evb エンジンは解凍をスキップして起動対応に留める。 $evbToolDir = Join-Path (Join-Path $publishDir "Engines") "Evb\Tools\evbunpack" if (!(Test-Path "$evbToolDir\evbunpack.exe")) { Write-Host "警告: EVB 解凍ツールが見つかりません: $evbToolDir\evbunpack.exe" -ForegroundColor Yellow Write-Host " Engines\Evb\Tools\evbunpack\README.md の手順で evbunpack.exe を配置してください。" -ForegroundColor Yellow } Write-Host "発行成功: $publishDir\GameLauncher.exe" -ForegroundColor Green } else { Write-Host "発行失敗 (終了コード: $LASTEXITCODE)" -ForegroundColor Red }