While building using Team Build, the build process creates one log file (for compilation and code analysis errors and warnings) per platform-flavor for all solutions. However, few weeks back, while talking to a customer about Team Build, a new requirement came up. The customer wanted to have one log file per platform-flavor per solution. In his scenario, they had not ran code analysis before and turning that on was resulting in lots of errors/warnings all across the team project. He wanted to separate the warnings out into different log files per solution as the owners were different.
He asked me if this could be done. Well yes, anything for the customer!!!
Attached is the code for custom MSBuild logger that –
- Listens to build error and warning events and creates one log file per solution per platform-flavor. This is different from the standard Team Build logger, which creates one log per platform-flavor for all solutions.
- Each log file contains all the compilation and code analysis errors/warnings in that solution.
- The log files created are copied to the drop location along with the other log files created by standard Team Build logger.
Using this logger is easy –
- Build the attached project and checkin the CustomTeamBuildLogger.dll to the build type folder i.e. same location as the TFSBuild.proj.
- Modify and add following to the TFSBuild.rsp file:
This is just one example of ease with which one can extend MSBuild and Team Build. If you are interested in writing custom logger, you will find following posts useful –