@echo off REM ======================================== REM 重新构建脚本 - 清理、还原、重新编译 REM ======================================== echo. echo ========================================== echo 重新构建 Sharp-Basic 解决方案 echo ========================================== echo. REM 切换到项目根目录 cd /d "%~dp0\.." echo [步骤 1/3] 清理项目... cd src\Sharp dotnet clean Sharp.sln --verbosity quiet cd ..\.. powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-ChildItem -Path '.' -Include bin,obj -Recurse -Directory -Force | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue" echo 清理完成 echo. echo [步骤 2/3] 还原 NuGet 包... cd src\Sharp dotnet restore Sharp.sln --verbosity quiet if %ERRORLEVEL% NEQ 0 ( echo. echo ========================================== echo NuGet 包还原失败! echo ========================================== cd ..\.. pause exit /b 1 ) echo 还原完成 cd ..\.. echo. echo [步骤 3/3] 构建解决方案... cd src\Sharp dotnet build Sharp.sln --configuration Release --no-restore if %ERRORLEVEL% EQU 0 ( echo. echo ========================================== echo 重新构建成功! echo ========================================== ) else ( echo. echo ========================================== echo 构建失败!错误代码: %ERRORLEVEL% echo ========================================== ) cd ..\.. echo. pause