Read currently installed Product Version

Got a problem you cannot solve? Try here.
Post Reply
kimatunit4
Posts: 18
Joined: Tue Jul 28, 2020 5:07 am

Read currently installed Product Version

Post by kimatunit4 »

Hi,

In the Project Options -> Product Version

I would like to know if there is away to compare Product Version of already installed (older) product with a newer that is being installed. So I can do a simple check to prevent an older version to uninstall a newer.

Thanks,

Kim
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Read currently installed Product Version

Post by FrancescoT »

The PRODUCTCODE is unique in each different product, and it doesn't change when building different versions of the same product.

You may eventually query the version number of the installed product, and which gets stored into the local system registry.

For example:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCTCODE}\Version

Hope this helps you.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
kimatunit4
Posts: 18
Joined: Tue Jul 28, 2020 5:07 am

Re: Read currently installed Product Version

Post by kimatunit4 »

Thanks,

I was hoping there was something that was built in like NEEDSUPGRADE and could be used to compare to VERSION in a simple way.

But reading from Windows registry goes as well like below:

if Variable NEEDSUPGRADE Equals TRUE
Set Variable INSTALLED_VERSION to
Read Registry Key HKLM\SOFTWARE\...\Uninstall\$PRODUCTCODE$\DisplayVersion into INSTALLED_VERSION
if Variable INSTALLED_VERSION Greater Than $VERSION$
MessageBox: Newer xxx version detected, A newer version of xxx is installed already.
Terminate Installation
else
Comment: Do what needs to be done if an older installation is in place already
end
...[*]
Post Reply