Code to help generate MSBuild compatible output

MSBuild console output

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:

  1. Extract the contents of the zip file to a directory if your choice
  2. Build OutputTest.dpr
  3. From a command prompt CD to the above directory and execute:

    %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe make.proj

You should see output similar to the above picture. Feel free to use/change/improve/tweak this code however you like.

1 thought on “Code to help generate MSBuild compatible output

  1. Could MSBuild tasks be added without using .NET, i.e. using COM? Otherwise Delphi 2007 is the first Delphi version where some extensions to the IDE functions cannot be added using Delphi itself.
    It would be a huge step backwards due to the use of a technology far beyond your control.

Comments are closed.