@echo off echo 正在编译XCamera项目... REM 设置MSBuild路径(根据您的Visual Studio版本调整) set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" if not exist %MSBUILD% ( echo 未找到MSBuild,请检查Visual Studio安装路径 echo 尝试使用其他路径... set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" if not exist %MSBUILD% ( echo 仍未找到MSBuild,请手动编译项目 pause exit /b 1 ) ) echo 使用MSBuild: %MSBUILD% REM 还原NuGet包 echo 正在还原NuGet包... cd /d "%~dp0" nuget.exe restore XCamera.sln if errorlevel 1 ( echo NuGet包还原失败,尝试直接编译... ) REM 编译项目 echo 正在编译项目... %MSBUILD% XCamera.sln /p:Configuration=Release /p:Platform="Any CPU" if errorlevel 1 ( echo 编译失败! pause exit /b 1 ) echo. echo 编译成功! echo 输出文件在: bin\Release\ echo. pause