3
votes

When Visual C++ builds (vcxproj) file form Visual Studio or you build it by means devenv (building sln), then you get log form the build of the vcxproj in file specified by item BuildLog.Path. Default value of this item is $(IntDir)\$(MSBuildProjectName).log

I’ve actually find this feature really useful for post build analysis per project.

I’d like to simulate this behavior by building just from msbuild.exe.

There are serious build automation reasons why I cannot use devenv now(as far as I’m aware I cannot build vcxproj by devenv without sln).

I've tried to resolve this problem by:

  1. creating custom target that determines value of BuildLog.Path and returns it back
  2. and then execute task Exec with msbuild commandline including argument that use filelogger to create log file

Problem is that it does not work!

There is an interesting thing that the default is specified by:

<ItemDefinitionGroup>
   <BuildLog>
      <Path>$(IntDir)\$(MSBuildProjectName).log</Path>
   </BuildLog>
</ItemDefinitionGroup>

If I understood correctly this specifies metadata path for each BuildLog item.

By default there is no BuildLog Item (because there is no Include in vcxproj –for BuildLog Item).

Does anybody has solution for this problem or can explain how to solve it?

  1. determine BuildLog.Path metadata or
  2. build vcxproj file just by msbuild with logging file to log file specified in vcxproj or inherited from props file