feat: 重构 TodoList 架构,新增动态 API 与 MAUI 内嵌 Web 服务
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$ScriptPath = $PSScriptRoot
|
||||
$MauiProjectPath = "d:\Proj\TodoList\src\TodoList.Maui"
|
||||
$Timestamp = Get-Date -Format "yyyy_MM_dd_HH_mm"
|
||||
|
||||
$OutputBasePath = Join-Path $ScriptPath "PublishOutput"
|
||||
$MauiPublishPath = Join-Path $OutputBasePath "TodoList.Maui"
|
||||
$ZipFileName = "TodoList_Publish_$Timestamp.zip"
|
||||
$ZipFilePath = Join-Path $ScriptPath $ZipFileName
|
||||
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "TodoList Publish Script" -ForegroundColor Cyan
|
||||
Write-Host "Timestamp: $Timestamp" -ForegroundColor Cyan
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
if (Test-Path $OutputBasePath) {
|
||||
Write-Host "Cleaning previous publish output..." -ForegroundColor Yellow
|
||||
Remove-Item $OutputBasePath -Recurse -Force
|
||||
}
|
||||
New-Item -ItemType Directory -Path $OutputBasePath -Force | Out-Null
|
||||
|
||||
Write-Host "[Step 1/2] Publishing TodoList.Maui..." -ForegroundColor Cyan
|
||||
$MauiProjectFile = Join-Path $MauiProjectPath "TodoList.Maui.csproj"
|
||||
dotnet publish $MauiProjectFile -f net10.0-windows10.0.19041.0 -c Release --self-contained false -o $MauiPublishPath
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "MAUI publish failed"
|
||||
exit 1
|
||||
}
|
||||
Write-Host "TodoList.Maui publish completed successfully!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "[Step 2/2] Creating ZIP package..." -ForegroundColor Cyan
|
||||
if (Test-Path $ZipFilePath) {
|
||||
Write-Host "Removing existing ZIP file..." -ForegroundColor Gray
|
||||
Remove-Item $ZipFilePath -Force
|
||||
}
|
||||
Compress-Archive -Path "$MauiPublishPath\*" -DestinationPath $ZipFilePath -Force
|
||||
Write-Host "ZIP package created: $ZipFilePath" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "Publish completed successfully!" -ForegroundColor Green
|
||||
Write-Host "Output: $ZipFilePath" -ForegroundColor Green
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user