Update produced by InstallShield 2012 reports installed version in bad format
During the upgrade, I see the following messages using the installer generated with InstallShield 2012 Spring:
- The InstallShield Wizard will update the installed version (9.01.005) of <our product> to version 9.2.0.53.
- The InstallShield Wizard updates (9.01.005) of <our product> to version 9.2.0.53.
These messages are based on string resources IDS_IFX_SDWELCOMMESSAGE_UPDATE_WELCOME
and IDS_IFX_STATUSEX_STATICTEXT_UPDATEUI
. I believe immutable string resources would look like this:
- The InstallShield Wizard will update the installed version (% VI)% P to version% VS. Click Next to continue.
- InstallShield Wizard updates (% VI)% P to version% VS.
although some resources indicate that the second line resource is: "InstallShield Wizard has updated% VI% P to version% VS."
The problem is that the old (installed) version number should be a displayable string like "9.1.5.2" instead of the formatted version of the internal version number like "9.01.005". As far as I understand, SdSubstituteProductInfo
uses IFX_INSTALLED_DISPLAY_VERSION
to fill in substitutions %VI
in OnUpdateUIBefore
standard InstallScript code. And IFX_INSTALLED_DISPLAY_VERSION
the default is from IFX_INSTALLED_VERSION
, which explains why the preferred display line doesn't appear where we would like it to. And my guess is that SdWelcome
(or any dialog or code similarly referencing IFX_INSTALLED_DISPLAY_VERSION
) also displays the poorly formatted version.
Despite all my internet searches about the functions, strings and string IDs mentioned above, I have not found a perfect solution for displaying a properly formatted old version number (DisplayVersion) in the correct format. Some articles suggest hardcoding a format string that skips the old version number instead of using a string resource that includes %VI
. Others suggest manually formatting the version number as desired and putting the result in IFX_INSTALLED_DISPLAY_VERSION
. I know there is a better answer and I want it to be easier to find next time I or someone else finds it.
source to share
In the OnBegin
InstallScript function, add the following line of InstallScript code as the first line after begin
:
RegDBGetItem(REGDB_UNINSTALL_DISPLAY_VERSION, IFX_INSTALLED_DISPLAY_VERSION);
Doing this in OnBegin also ensures that another message not mentioned in the question is using the correct format:
The tweak found that version% VI% P is already installed.
This installation installs an earlier version of% P (% VS).
Before installing this version, you will have to uninstall the previous version.
source to share