Building a project in Delphi 10.3 fails if the build script output contains “error:”

I just had a nasty surprise with Delphi 10.3 when trying to build a project that worked fine with previous Delphi versions. The problem turned out the text one of my pre build events wrote to the output. It contained the string “error :”. Apparently Delphi 10.3 parses the output of the build events and tries to interpret it.

Try for yourself:

  • Create a batch file test.cmd with the following content:
    @echo error: bla
    
  • Add it as a pre build event to a Delphi project:
    call path\to\test.cmd
    
  • Try to compile.

If I’m right, you will get an error like:

And the Messages window will contain the following error:

[Exec Error] EXEC(1): bla

Very annoying. If this is documented, I can’t find it. I only see:

Cancel on error

Cancels the project build if a command returns a nonzero error code.

on http://docwiki.embarcadero.com/RADStudio/Rio/en/Build_Events and http://docwiki.embarcadero.com/RADStudio/Rio/en/Creating_Build_Events