When the Delphi team switched it’s build process to MSBuild and started running Zombie under a Continuous Integration Environment the test automation framework also had to be updated to output MSBuild style errors. MSBuild recognizes errors which follow a specific format allowing it to colorize them as well as report them back to the calling process. Without proper error formatting MSBuild will simply continue merrily along without the slightest clue something might have failed.
Here is a zip file that contains a small Delphi unit which implements an MSBuildStr function with multiple overloads to help you create MSBuild compatible output. The zip also contains a simple console application which illustrates calling the MSBuildStr functions and a MSBuild .proj file that allows you to test the output. This unit doesn’t cover every single form of MSBuild style output but it does cover some of the most common uses. To test the sample console app:
- Extract the contents of the zip file to a directory if your choice
- Build OutputTest.dpr
- From a command prompt CD to the above directory and execute:
You should see output similar to the above picture. Feel free to use/change/improve/tweak this code however you like.