msbuild 编译指定工程时构建脚本的配置

有时候 ,我们编译windows的exe时,我们不需要编译所以的工程,我们只需要指定某个工程就好了,此时我们使用/t:工程名:Rebuild(如果要编译全部工程就把工程名去掉,即/t:Rebuild)。

具体如下:

set msbuild="C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"

set command_part=/t:PCCast2:Rebuild 

set sln_file=%cur_path%\ToB-Win-App.sln

set vcvars="%VS2015_HOME%\VC\vcvarsall.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

转载于:https://www.cnblogs.com/zndxall/p/10502089.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值