How to separate MSBuild logs by project files

loggingmsbuild

I have a very complex set of MSBuild projects. Often, one .proj will invoke the <MSBuild> task to build another project file.

When reading the console log, it's hard to see which invocation of MSBuild I'm looking at.

Is there a way to make the log either:

  • Indent the output from sub-invocations of MSBuild, or
  • Put each MSBuild log in t oa new file

Preferably without spending a lot of time writing a new logger.

Best Answer

I cannot think of a way that you could do this. You might be able to attach an XML logger (which are availabe on the internet) and then create your own XSLT to create the formatted output that you want. If you did want the logs to be in different files then you could replace your usage of the MSBuild task with the Exec task and on the Command you can specify a different log file.

Sayed Ibrahim Hashimi

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build