How to do you manage and display the Version# (eg., FileVersion) for WEB Core apps?

In VCL apps, I set the FileVersion to auto-increment when doing a Build, and it's saved as a resource in the EXE. It can be extracted at run-time and displayed somewhere.

I see that the Version Info tab is in the Project Options with WEB Core apps, but how is it used? Where are the fields saved?

I don't know if there's an official way to get at this information, but I wrote about how I handle it in my projects in this post. Search for the "Version Information" section and you'll get an example of how to pull the values into the app. Probably more JavaScript than anyone might care for, given the desire to do things the Delphi way, but you can certainly take the information and run with it however you like.

1 Like

Also covered in the manual

page 42

1 Like

I didn't realize there was a separate Version# from the other one.

So how do you access that Version# to display somewhere?

Try
application.Version

1 Like

Nope, Application.Version shows "2.1.0.0 Rotondo"

You can always read it from the URL if you use it this way

oh, I see ... it gets added to the file name: myproj_1_0_1.js

@AndrewSimard I was able to get that to work. Thanks!

But I'm not getting any auto-incrementing happening. I've got it set to True, and Version set to 1.0.18, but it never changes the version#.

Odd. I usually have the opposite problem. After a day of working on a project, I end up with 100 versions of the js file. In the VCL, the number is normally only updated after a full project "build" step, whereas here it is updated every time you hit F9. So way more often.

Also, make sure that you're refreshing your browser. Might seem like a silly thing to say, but browsers really like to cache things, and large JavaScript libraries are one of the things they like to cache the most I think. So be sure to hit Ctrl-R or whatever it is for your browser of choice to do something closer to a hard refresh. Many times I've been poking at something, wondering why the change I just made didn't materialize, only to realize that the app itself was not being updated.

I don't hit F9 for WEB Core apps. I hit the green arrow at the top that runs it without debugging and it opens a browser window. I know the VCL only increments the number if you hit Built, but not Compile. But for WEB Core, neither one does it. That's what I'm wondering about.

Basically, I just leave the browser window open and hit the F5 key to refresh the page. Sometimes -F5 to force a reload.

I think there's a meta tag that can be added to the index.html page that forces a full refresh, right? Or you can set the time between refreshes.

Possibly. What I'd check for first though is whether, in your release/debug directory, new JS versions are being generated and you're just not seeing the latest version in the running app?

They are not. I just keep getting the same version, 1_0_18. The WEB Core manual only says it auto-increments, but it does not say what triggers it. You're suggesting it's F9. VCL is the Build command. I'm not seeing it with either Compile or Build, so maybe it IS the F9 key, which I'm not using. Maybe @brunofierens or someone from TMS can clarify for us.

I didn't mean to imply F9 explicitly - I meant just "run" vs. "build". Odd though, I don't recall anything special needed for this - just set the current version number and the autoincrement option and away it goes.

Just that if you're looking at the browser page (and not the actual build folder), and you're not changing anything dramatic, you might not notice if the running app isn't the latest version, even after a normal reload. The Ctrl+R reload seems to clear this most of the time. This still trips me up on a regular basis.

That's why I posted this question originally -- I like to display the version# somewhere obvious so I can tell if it's being updated properly, as I've had occasion to hit <command>-R several times and not see the changes I expected. So now I'm seeing the version# but it's not incrementing from one build to the next. Must be the Full Moon ...

Hello! It might be of some interest for you, so I would like to present my "workflow" for version numbering:

I compile using the command line compiler for TMS WebCore, so no automatic version numbering is done. So I use my own version, which is composed of the date and a letter (e.g. the first compile of today would have version 3.7.5a). The batch file gets this version as a parameter and has the line

@echo '%2' > BUILD.CON

to write the version info into a file.
The pascal source code contains the lines

const _BUILDNR=
{$I BUILD.CON}
;

to read this version into a global constant.

The batch file also uploads the new .js and .html to the server and after that calls a tool which writes the version number to a MySQL server, from where the WebCore app reads it on startup and compares it with the contained number. If the number differs (because of browser caching), it presents an "Update!" button to the user, which reloads the application on hit.

Best regards,
Meik Stoll

2 Likes