The issue seems to be that madExcept and the entire mad suite adds references to the include files and libraries to
HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\CodeGear\BDS\7.0\...
Since the TeamCity build agent runs as another user this information is not available to it.