有时候 ,我们编译windows的exe时,我们不需要编译所有的工程,我们只需要指定某个工程就好了,此时我们使用/t:工程名:Rebuild(如果要编译全部工程就把工程名去掉,即/t:Rebuild)。
具体如下:
set msbuild="C:Program Files (x86)MSBuild14.0Binmsbuild.exe"
set command_part=/t:PCCast2:Rebuild
set sln_file=%cur_path%ToB-Win-App.sln
set vcvars="%VS2015_HOME%VCvcvarsall.bat"
echo "=====================set %platform% env========================"
if "%platform%"=="x86" call %vcvars% x86
if "%platform%"=="x64" call %vcvars% x86_amd64
:: build type, debug or release
set type_tmp=%1
if "%type_tmp%" == "Release_Static" (
echo "++++++++++++++++++++++it is Release Static+++++++++++++++++++"
set type="Release Static"
)else if "%type_tmp%" == "Debug_Static" (
echo "++++++++++++++++++++++it is Debug Static+++++++++++++++++++++++"
set type="Debug Static"
)else (
echo "++++++++++++++++++++++++change type+++++++++++++++++++++++++++++"
set type=%type_tmp%
)
%msbuild% %sln_file% %command_part% /p:Configuration=%type%;Platform=%platform%
参考:
https://docs.microsoft.com/zh-cn/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe?view=vs-2015