我有几个要使用命令行构建的Visual Studio 2015解决方案文件。我希望将输出存储在单个文件中
这是构建解决方案的批处理文件的内容。
echo off
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
set _SCRIPT_DRIVE=%~d0
echo DRIVE %_SCRIPT_DRIVE%
set baseDir=%_SCRIPT_DRIVE%\Source\Service\4.0\Branches\ARES
echo baseDir = %baseDir%
set buildLog=%baseDir%\Build.log
rem these are the directory names / solution name of the projects I want to build
rem you can build 'n' solutions and use your own instead of me giving you the solution and code
set thirdParty=Cert,ManagedHooks,NLog,Newtonsoft.Json,RabbitMQ,MDTE
echo.
echo building %thirdParty%
echo.
for %%p in (%thirdParty%) do (
echo.
echo building %%p
cd %%p
set thirdPartySolutionFile=%%p%.sln
echo solution file : %thirdPartySolutionFile%
MSBuild %thirdPartySolutionFile% /t:Rebuild /m /p:Configuration=Debug > %buildLog%
cd ..
)
我只获取存储在日志文件中的最新项目构建信息
答案 0 :(得分:2)
>>是答案
https://www.tutorialspoint.com/batch_script/batch_script_appending_files.htm
>覆盖%buildLog%文件。
>>会将输入追加到此文件
因此,调用构建工具并将输出发送到文件的行应更改为在其中包含>>而不是>
MSBuild %thirdPartySolutionFile% /t:Rebuild /m /p:Configuration=Debug >> %buildLog%