Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I determine the Delphi version which created a Delphi project

Tags:

delphi

I am trying to automatically figure out which Delphi version (of Delphi 5 to XE2 installed on my computer) to use to open a given project without upgrading that project by mistake.

Up to Delphi 7 there is a .dof file in .ini format for each project. Delphi 5 does not have any entry which might help, but starting from Delphi 6 there is a [FileVersion] section which contains the following values:

  • Delphi 5: N/A
  • Delphi 6: 6.0
  • Delphi 7: 7.0

So I guess that settles that, since older Delphi versions do not concern me.

For Delphi 2005 and 2006 there is a .bdsproj file in XML format containing a version entry: \BorlandProject\PersonalityInfo\Option\Option

In Delphi 2005 it looks like this:

<Option Name="Version" Type="String">1.0</Option>

In Delphi 2006 like this:

<Option Name="Version">1.0</Option>

So I could look whether the attribute "Type" exists and depending on that decide on Delphi 2005 or 2006. Could somebody please have a look at his Delphi 2005 and 2006 projects and verify this difference? (Or do you maybe have got a better idea?)

edit: I just tried to verify this and found, that Delphi 2005 does not always add the Type-Attribute. So now I am stuck.

edit: Maybe the GUID stored there is unique to the Delphi version?

  • Delphi 2005: {87D03616-A4C7-4B5A-AF0F-0164EA60BC59}
  • Delphi 2006: {CFE1BEE6-6FDE-4241-8CA5-D38D14EAA768}

Somehow I doubt it, I am afraid that the GUID may represent different SKUs (Professional / Architect etc.). But maybe you could verify this?

Starting with Delphi 2007 there is a .dproj file in a different XML format. The Delphi 2007 format does not contain any version entry I could find, but from Delphi 2009 on there seems to be the following entry:

\project\PropertyGroup\ProjectVersion

These are the values I found in my .dproj files:

  • Delphi 2007: N/A
  • Delphi 2009: 12.0
  • Delphi 2010: 12.0
  • Delphi XE: 12.3
  • Delphi XE2: 13.4

If these are correct, I could reliably determine Delphi 2007, XE and XE2. But how do I distinguish between Delphi 2009 and 2010?

Also, these numbers look odd to me. Does anybody know whether there are any differences between the various updates of Delphi, e.g. did the original Delphi XE2 release maybe start with 13.0 and with each update increment the number after the dot? But if that's the case, how did Delphi XE get 12.3?

(There is a similar question How can I tell what version of Delphi was used to create a project but the single answer there is quite limited.)

Just in case anybody else needs this: I have just added a page to the Delphi Wiki which summarizes all answers and adds information for newer Delphi versions (currently up to Delphi 10.4.1).

like image 234
dummzeuch Avatar asked Mar 18 '12 11:03

dummzeuch


3 Answers

I have now compared the .bdsproj files of Delphi 2005 and 2006 and there is no difference. Also, there is no difference between the .dproj files created by Delphi 2009 and 2010.

So the answer is:

  • if a .dproj file exists -> read \project\PropertyGroup\ProjectVersion
    • empty -> Delphi 2007
    • 12.0 -> Delphi 2009 or 2010
    • 12.2 or 12.3 -> Delphi XE1 (according to Uwe Schuster)
    • 13.4 -> Delphi XE2
  • if a .bdsproj file exists -> Delphi 2005 or 2006
  • if a .dof file exists -> read [FileVersion]\version
    • empty -> Delphi 5 (or possibly older)
    • 6.0 -> Delphi 6
    • 7.0 -> Delphi 7

Unfortunately this does not allow me to write a program that automatically starts the correct Delphi version for a given project.

Maybe I will let the program ask the user if there are two possibilities and store his answer in a .ini file so the next time the program knows which Delphi version to start.

btw: The reason I was looking into this is that I have several times accidentally opened Delphi 2007 projects with a later Delphi version which upgraded it and I had to reverse these changes by hand. This has become so annoying that I wanted to prevent it by registering my own program as handler for .dpr files.

like image 183
dummzeuch Avatar answered Oct 17 '22 12:10

dummzeuch


The version numbers in the *PROJ files are not bound to releases or updates and not all versions hit the streets.

  • Delphi XE RTM used version 12.2
  • Delphi XE Update #1 uses version 12.3
  • Delphi XE2 (RTM till Update #4) uses 13.4
like image 34
Uwe Schuster Avatar answered Oct 17 '22 12:10

Uwe Schuster


Just installed XE3 (RTM). 14.3 XE3 (C++ & Delphi)

like image 4
Rhys Drummond Avatar answered Oct 17 '22 14:10

Rhys Drummond