param( [string]$PackagePath = "$PSScriptRoot\..\src\Hua.Cli\bin\Debug\Hua.Cli.0.0.3.nupkg" ) Write-Host "== Hua.Cli 本地安装 ==" -ForegroundColor Cyan Write-Host "编译并打包..." -ForegroundColor Yellow $projPath = "$PSScriptRoot\..\src\Hua.Cli\Hua.Cli.csproj" dotnet build $projPath -c Debug dotnet pack $projPath -c Debug -o (Split-Path $PackagePath -Parent) --no-build if (-not (Test-Path $PackagePath)) { Write-Host "包文件不存在: $PackagePath" -ForegroundColor Red exit 1 } $nupkgDir = Split-Path $PackagePath -Parent Write-Host "包路径: $PackagePath" -ForegroundColor Gray Write-Host "卸载旧版本..." -ForegroundColor Yellow dotnet tool uninstall -g Hua.Cli 2>$null Write-Host "安装本地版本..." -ForegroundColor Green dotnet tool install -g Hua.Cli --add-source $nupkgDir --prerelease Write-Host "== 完成 ==" -ForegroundColor Cyan Write-Host "" hua help