mirror of
https://github.com/zhang-pu/zpclean.git
synced 2026-12-01 09:18:28 +08:00
22 lines
912 B
PowerShell
22 lines
912 B
PowerShell
# ZPclean 构建脚本(Windows 上执行)
|
||
# 用法:右键 → 使用 PowerShell 运行;或在 PowerShell 里: .\build.ps1
|
||
$ErrorActionPreference = "Stop"
|
||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||
Set-Location $here
|
||
|
||
Write-Host "== 检查 dotnet SDK ==" -ForegroundColor Cyan
|
||
$ver = dotnet --version
|
||
Write-Host "SDK 版本: $ver"
|
||
|
||
Write-Host "== 还原依赖 ==" -ForegroundColor Cyan
|
||
dotnet restore
|
||
|
||
Write-Host "== 编译(Release)==" -ForegroundColor Cyan
|
||
dotnet build -c Release -warnaserror:false
|
||
|
||
Write-Host "== 发布单文件 exe ==" -ForegroundColor Cyan
|
||
dotnet publish -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -o ".\publish"
|
||
|
||
Write-Host ""
|
||
Write-Host "完成。产物在: $here\publish\ZPclean.exe" -ForegroundColor Green
|
||
Write-Host "(自包含版:把上面命令里的 --self-contained false 改成 true,exe 更大但不依赖装 .NET)"
|