企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ### vs2010 #### 用vs2010的devenv编译项目语法: ``` C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe /build "Release|Win32" "xxx.sln" /out build.log ``` 脚本示例msbuild.bat: ``` SET FILENAME=%1 SET PACKAGE_FILES=%cd% set LOG=%PACKAGE_FILES%\build.log cd .. SET bbd=%cd% ::最后一位 SET REBUILD=%2 if "%REBUILD%"=="" ( SET REBUILD="build" )else ( SET REBUILD="Rebuild" ) SET SLNFILE=%bbd%\%FILENAME%\xxx.sln SET DEVENV2010="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" ::-----------start build ... if not exist "%bbd%\%FILENAME%" ( echo "%bbd%\%FILENAME% is not exist!!" goto :eof ) echo "-----------start DEVENV2010 ..." if exist "%SLNFILE%" ( if exist "%LOG%" del "%LOG%" %DEVENV2010% /build "Release|Win32" "%SLNFILE%" /out "%LOG%" ::&& tail -f "%LOG%" ) else ( echo "%SLNFILE% is not exist,start call build.bat ..." goto :eof ) echo "-----------end DEVENV2010 ..." rem -----------end build ... :: -----------start move file ... cd "%PACKAGE_FILES%" call move_exe.bat %1 rem -----------end move file ... ::-----------start packge file ... cd "%PACKAGE_FILES%" call nsis.bat rem -----------end packge file ... ``` #### nsis打包项目的命令语法: ``` $ makensis.exe xxx_new.nsi ``` 移动编译好的文件到nsis的打包目录 nsis.bat ``` SET PACKAGE_FILES=%cd% cd .. SET nsisdevC= %cd%\NSIS\makensis.exe SET FILENAME=xxx_new.nsi echo %nsisdevC% cd %PACKAGE_FILES% %nsisdevC% %PACKAGE_FILES%\%FILENAME% ``` ### vs2017 #### 利用vs2017 的msbuild来编译 语法: ``` C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe %xxx.sln% /t:build /p:VisualStudioVersion=14.1 /p:Platform=x64 /p:Configuration=Release /m ``` ``` SET FILENAME=%1 SET VERSION=%2 SET PACKAGE_FILES=%cd% cd .. SET bbd=%cd% ::最后一位 SET REBUILD=%3 if "%REBUILD%"=="" ( SET REBUILD="build" )else ( SET REBUILD="Rebuild" ) SET SLNFILE=%bbd%\%FILENAME%\build\xxx.sln SET MSBuild="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" ::-----------start build ... if not exist "%bbd%\%FILENAME%" ( echo "%bbd%\%FILENAME% is not exist!!" goto :eof ) echo "-----------start msbuild ..." if exist "%SLNFILE%" ( %MSBuild% %SLNFILE% /t:%REBUILD% /p:VisualStudioVersion=14.1 /p:Platform=x64 /p:Configuration=Release /m ) else ( echo "%SLNFILE% is not exist,start call build.bat ..." cd "%bbd%\%FILENAME%" call build.bat %MSBuild% %SLNFILE% /t:%REBUILD% /p:VisualStudioVersion=14.1 /p:Platform=x64 /p:Configuration=Release /m ) echo "-----------end msbuild ..." rem -----------end build ... :: -----------start move file ... cd "%PACKAGE_FILES%" call move_exe.bat %1 cd "%PACKAGE_FILES%" call move_map_pdb.bat %1 rem -----------end move file ... ::-----------start packge file ... cd "%PACKAGE_FILES%" call nsis.bat %2 rem -----------end packge file ... ``` #### nsis打包项目的命令语法: ``` $ makensis.exe xxx_new.nsi ``` 移动编译好的文件到nsis的打包目录 nsis.bat ``` SET PACKAGE_FILES=%cd% cd .. SET nsisdevC= %cd%\NSIS\makensis.exe SET FILENAME=xxx_new.nsi echo %nsisdevC% cd %PACKAGE_FILES% %nsisdevC% %PACKAGE_FILES%\%FILENAME% ```