1

I was assigned to make a small modification in a Delphi project. To register that mod, my boss told me to increment the build number in Project options > Version Info.

I did that, but after compiling and building, when I look at the file properties, file version is not updated. The exe file was indeed compiled (I checked the modification date and it matches the time of build). The version number in the final EXE is unchanged, and not equal to the number I set in Version Info tab.

When I search Google about this, the only results I could find was tutorials to use this version feature and people with problems enabling it.

I tried reopening the project, deleting the generated EXE and rebuilding, removed the .RES file (the build fails because there's no RES file) and commented out the {$R *.RES} directive (no Version Info is included at all).

I'm not the original developer of this project, and the original one is not available anymore.

I think this could be related to this post, but it is from another Delphi version, and I couldn't find a dproj file in my project.

So, anyone knows whats wrong? Is it some kind of bug or am I missing something? Is there another option I should change so this option takes effect?

Community
  • 1
  • 1
ricardomenzer
  • 268
  • 3
  • 16
  • 1
    Stop using the IDE for this. It's the wrong tool. Use a resource script. Manually edited, or better still, programmatically generated. – David Heffernan Aug 07 '15 at 18:57
  • Thanks for commenting. It looks like this is the tool previously used to do this in the company I'm working now. For now, I would prefer the keep this way. Do you know any reason so this is not working in my case? – ricardomenzer Aug 07 '15 at 19:14
  • That part of the IDE sucks. If personally have no idea how to make it work because it's such a bad idea to use it. I suggest you talk to your boss. – David Heffernan Aug 07 '15 at 19:17
  • I have seen cases where the IDE does compile a new .exe file with the correct updated version info, but Windows Explorer continues displaying older version info from a previous build that was in the same location as the new file. Try copying the latest .exe with the updated version info to another folder, or even another machine, and then check if the version info is correct or not. Or, use a separate tool that can open the .exe and display its actual version resource(s). – Remy Lebeau Aug 07 '15 at 19:23
  • 5
    @DavidHeffernan: the IDE's handling of version resources did not really start suffering until around XE2, when they really started messing around with version resources due to the addition of multiple platform support, and the "auto increment build number" (an incrementing number) being replaced with "auto generate build number" (a timestamp). Or maybe it was a little earlier, when support for build configurations was added. But either way, it was after Delphi 7, which did not have those features yet. – Remy Lebeau Aug 07 '15 at 19:32
  • @Remy Versioning stored in binary resources that are not visible to change control is broken by design – David Heffernan Aug 07 '15 at 19:35
  • @RemyLebeau, this is very strange. I moved the EXE to a Win 8.1 computer and checked the version. It showed 2.2.0.1016 (the wrong number), but when I open the EXE in HxD (Hex editor) and search for this string (in unicode mode), it didn't find any occurrences. But when I search for the correct string (2.2.0.1017) there's one occurrence, next to a FileVersion string. Really strange. From where is Windows reading the 2.2.0.1016 string?? – ricardomenzer Aug 07 '15 at 19:55
  • This is annoying because the form Caption shows the version number, and it is showing the wrong number. – ricardomenzer Aug 07 '15 at 19:56
  • OK, I did search the EXE for the Binary 1016. Found two instances at the end of file, near a VS_VERSION_INFO "thing". Changed the binary values to 1017, as I want them to be, and now the version is correctly showed in the file properties and the program title bar. So my previosly question is answered: windows take these values from binary data, not from the string. This brings me to another question: why delphi is not generating the right values at these locations? – ricardomenzer Aug 07 '15 at 20:06
  • @ricardomenzer: Sounds like you have set the `Major/Minor/Release/Build` fields in the project settings to 2, 2, 0, 1016 respectively, but have the `FileVersion` string field set to `2.2.0.1017` instead. They are stored separately in the version resource, so make sure they actually match each other in the project settings. When you set the `Major/Minor/Release/Build` fields, the `FileVersion` is set automatically to match, so you must have tweaked the `FileVersion` manually. Just set the `Build` field to 1017 to match. – Remy Lebeau Aug 07 '15 at 20:14
  • @RemyLebeau If you are saying about the number boxes in the Version Info tab of Project Options, it is exactly where I am changing that number. I didn't touch the key/value in the bottom part of this box, but I can see the FileVersion key is updated when I change the number boxes and match the values selected in them. I want to post a screenshot showing the problem, but still didn't have enough reputation to post images. – ricardomenzer Aug 07 '15 at 20:24
  • I just found the culprit! There were two projects stored in the same folder. Both were in the exact the same version number. The dpr file of the project I want to change had the following directive: `{$R *.RES}`. But delphi was using the resource file from the other project. I changed this line to specify the resource file of the right project and now it is building the executable with the right version numbers. I was inspired by [this](http://www.delphigroups.info/2/1/778500.html) forum thread. – ricardomenzer Aug 10 '15 at 12:21

1 Answers1

0

Use build instead of compile... it have no shortcut, you find it in Project menu (under compile)

Needback
  • 1
  • 1