Sometimes you have a Delphi project and don't know which Delphi version you should use to build it. Here are some hints to find out (based on this  Stack Overflow question and the answers):
- If there is a .dproj file, it's a Delphi version >= 2007.
- If there is a .bdsproj file, it's Delphi 2005 or 2006.
- If there is none of the above, there should be a .dof file. If there is, it's Delphi <=7.
- If there is not even a .dof file, you are stuck, sorry.
By analyzing these files, we can find out more:
.dof files Edit
.dof files are files in INI format. The .dof file of Delphi 6 and 7 contains a [FileVersion] section which gives the Delphi version with the following values:
- Delphi 7: 7.0
- Delphi 6: 6.0
If no version is given, look at the Packages entry in the [directories] section. The package names include the Delphi version number multiplied by 10:
- Delphi 5: Packages=...;Vcl50;...
- Delphi 4: Packages=...;VCL40;...
- Delphi 3: Packages=...;VCL30;...
.bdsproj files Edit
.bdsproj files are in xml format and created by Delphi 2005 and 2006. Unfortunately there seems to be no way to distinguish reliably between these versions.
You might get lucky, though: If the project has excluded packages, the name of these packages might contain the version suffix: 90 for Delphi 2005 and 100 for Delphi 2006.
.dproj files Edit
.dproj files are also xml format. Delphi since version 2007 creates this type of file but they are not backwards compatible. If you open a .dproj file created by e.g. Delphi XE with Delphi 2007 you will get an error. To find out which Delphi version created it, look at \project\PropertyGroup\ProjectVersion:
- Delphi 2007: empty
- Delphi 2009 and 2010: 12.0
- Delphi XE: 12.2
- Update1: 12.3
- Delphi XE2: 13.4
- Delphi XE3: 14.3
- Update 2: 14.4
- Delphi XE4: 14.4 (ouch!)
- Update 1: 14.6
- Delphi XE5: 15.1 or 15.3
- Delphi XE6: 15.4
- Delphi XE7: 16.0
- Update 1: 16.1
- Delphi XE8: 17.2
- Delphi 10 Seattle: 18.0
- Update 1: 18.1
- Delphi 10.1 Berlin: 18.1 (ouch!)
- Update 1: 18.2
- Delphi 10.2 Tokyo: 18.2 (ouch!)
- Update 2: 18.3
- Update 3: 18.4
- Delphi 10.3 Rio: 18.5
- Update 1: 18.6
- Update 2: 18.7
As you can see, there can be different version numbers even for the same Delphi version. These can be explained with different updates. Interestingly Delphi XE6 identified itself as an update to Delphi XE5, according to the version number, similar with XE4 and XE3.
Unfortunately there seems to be no way do distinguish between Delphi 2009 and 2010 reliably, the same applies to Delphi 10 Update 1 and 10.1. Again, the list of excluded packages might give a hint, if the names of these packages contain the version suffix:
- Delphi 2009: 120
- Delphi 2010: 140
- Delphi 10 Seattle: 230
- Delphi 10.1 Berlin: 240
But be aware that these lists are not necessarily changed correctly when the IDE upgrades a project from one version to the next.