Files
Migu2.0/scripts/redeploy-simplelite.ps1
T

30 lines
1.4 KiB
PowerShell
Raw Normal View History

# 将最新编译的 SimpleLite 部署到 bin\Debug 并提示重启。
# 用法:先关闭 SimpleLite(任务管理器或托盘退出),再运行本脚本。
$ErrorActionPreference = 'Stop'
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
$slProj = Join-Path $repoRoot 'Simple\SimpleLite\SimpleLite.csproj'
$outDir = Join-Path $repoRoot 'Simple\SimpleLite\bin\Debug'
$objDll = Join-Path $repoRoot 'Simple\SimpleLite\obj\Debug\SimpleLite.dll'
Write-Host '==> 编译 SimpleLite (DisableFody)...' -ForegroundColor Cyan
dotnet build $slProj -c Debug -p:DisableFody=true
if ($LASTEXITCODE -ne 0) { throw "dotnet build 失败 (exit $LASTEXITCODE)" }
$builtDll = if (Test-Path $objDll) { $objDll } else { Join-Path $outDir 'SimpleLite.dll' }
if (Get-Process SimpleLite -ErrorAction SilentlyContinue) {
Write-Host ''
Write-Host 'SimpleLite 仍在运行,无法覆盖 DLL。请先关闭 SimpleLite.exe,再重新运行本脚本。' -ForegroundColor Yellow
exit 1
}
Copy-Item $builtDll (Join-Path $outDir 'SimpleLite.dll') -Force
$objExe = Join-Path $repoRoot 'Simple\SimpleLite\obj\Debug\SimpleLite.exe'
if (Test-Path $objExe) {
Copy-Item $objExe (Join-Path $outDir 'SimpleLite.exe') -Force
}
Write-Host '==> 已更新' $outDir -ForegroundColor Green
Write-Host '请重新登录迷榖平台(或手动启动 SimpleLite.exe)以加载新 API。'