The background here was a quick project at a client where many
.dproj files were in the same directory, but they suffered from conditional define differences. Which meant that even if they were all using the
DEBUG configuration, some defines in the
.dproj directories were different therefore poisoning shared
.DCU files (as Delphi does not automatically rebuild them when the sources have not changed even though the IDE switched to a new project).
There was no quick possibility to reorganise the project structure (a combination of a version system history being problematic and potentially lots of relative path references in the
.dpr files could still be broken) so I wanted different “Unit Output Directories” for each project preferably using non-hardcoded project name.
So I tried putting
$(PROJECTNAME) in a “Unit Output Directory”. But unlike build-events – where that one has a value – in the Directory it hadn’t.
To cut things short, Uwe Raabe did some spelunking in the
.dproj file and found that
$(SanitizedProjectName) was recognised so I switched to
So I did some more spelunking coming with the below list. Remember though:
Only tested for
Win32applications for Delphi XE8
I assembled the list by doing a quick
sed on a Delphi XE8 Win32
.dproj file transforming all XML element names to
$() form then running it through a
uniq like script. After that I added each of them in a “Unit Output Directory” prepended with
.\_\ (well I cheated a bit, I did them in groups separated by a back-slash and went back to single items in case of failures. A kind of ‘binary search’).
These expand to empty strings: