Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Auto generate build number and GetFileVersionInfo



Permlink Replies: 6 - Last Post: Jul 21, 2016 12:16 PM Last Post By: Grigoriy Vasilc...
Grigoriy Vasilc...

Posts: 5
Registered: 8/15/16
Auto generate build number and GetFileVersionInfo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 15, 2016 10:01 AM
Hello.

If I select "Auto generate build number" (Project Options -> Version Info), after build in file properties I see version like 1.0.6040.15852. In code via GetFileVersionInfo I get file version 1.0.0.0. When I change build number option to any other then file version retrieves fine. How can I get file version with "Auto generate build number"?

P.S. Embarcadero XE8.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Auto generate build number and GetFileVersionInfo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 16, 2016 4:14 PM   in response to: Grigoriy Vasilc... in response to: Grigoriy Vasilc...
Grigoriy wrote:

If I select "Auto generate build number" (Project Options -> Version
Info), after build in file properties I see version like
1.0.6040.15852. In code via GetFileVersionInfo I get file version
1.0.0.0.

A project can have multiple Build configurations, and each configuration
can define its own version resource. Make sure you have disabled any duplicate
version resources and/or are compiling the correct configuration into your
executable.

--
Remy Lebeau (TeamB)
Grigoriy Vasilc...

Posts: 5
Registered: 8/15/16
Re: Auto generate build number and GetFileVersionInfo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 16, 2016 10:07 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
A project can have multiple Build configurations, and each configuration
can define its own version resource. Make sure you have disabled any duplicate
version resources and/or are compiling the correct configuration into your
executable.

Yes, I know that. I'm saying about one executable, which file version at the same time in explorer->file properties is 1.0.6040.15852, but GetFileVersionInfo shows me version 1.0.0.0. If I change build number option to "Auto increment build number", then in both places I see the same version (i.e. 1.0.0.1). How can it be?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Auto generate build number and GetFileVersionInfo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 18, 2016 12:56 PM   in response to: Grigoriy Vasilc... in response to: Grigoriy Vasilc...
Grigoriy wrote:

Yes, I know that. I'm saying about one executable, which file
version at the same time in explorer->file properties is 1.0.6040.15852,
but GetFileVersionInfo shows me version 1.0.0.0.

When calling VerQueryValue(), are you retreiving the root VS_FIXEDFILEINFO
structure, or are you retreiving the "FileVersion"/"ProductVersion" value
of a localized structure? It makes a big difference to your issue.

--
Remy Lebeau (TeamB)
Grigoriy Vasilc...

Posts: 5
Registered: 8/15/16
Re: Auto generate build number and GetFileVersionInfo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 21, 2016 12:16 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
When calling VerQueryValue(), are you retreiving the root VS_FIXEDFILEINFO
structure, or are you retreiving the "FileVersion"/"ProductVersion" value
of a localized structure? It makes a big difference to your issue.
Remy Lebeau (TeamB)

I retrieved localized structure. Working with VS_FIXEDFILEINFO solves the problem.

Thanks!
Grigoriy Vasilc...

Posts: 5
Registered: 8/15/16
Re: Auto generate build number and GetFileVersionInfo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 17, 2016 9:54 PM   in response to: Grigoriy Vasilc... in response to: Grigoriy Vasilc...
Using ResEdit I discovered that there are two different file versions placed in "General information" and language specific "File Information". If auto increment option selected, then versions in both fields are equal, if auto generate - then they differ [screenshots | https://forums.embarcadero.com/thread.jspa?threadID=227495&tstart=0 . It looks like GetFileVersionInfo returns language specific file information. Is there any way to get General Information file version?

Edited by: Grigoriy Vasilchenko on Jul 18, 2016 12:45 AM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Auto generate build number and GetFileVersionInfo [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 18, 2016 1:08 PM   in response to: Grigoriy Vasilc... in response to: Grigoriy Vasilc...
Grigoriy wrote:

Using ResEdit I discovered that there are two different file versions
placed in "General information" and language specific "File Information".
If auto increment option selected, then versions in both fields are
equal, if auto generate - then they differ

Then that would be an IDE bug, and should be reported to Embarcadero.

It looks like GetFileVersionInfo returns language specific file
information.

There is only one version resource in the executable, and it can contain
multiple language-specific subblocks. GetFileVersionInfo() accesses the
entire version resource as a whole. It is VerQueryValue() that accesses
the individual subblocks, as requested by the caller.

Is there any way to get General Information file version?

Call VerQueryValue() with the lpSubBlock parameter set to '\' to retreive
the root VS_FIXEDFILEINFO structure, which is language-independent.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02