InnovRick
Posts: 9
Joined: Wed May 22, 2013 4:16 pm

Finding install path using UpgradeCode

Hi,

I am trying to find the installation path of a product so I can install another product in the same directory. We do have a key containing the installation path but the key path varies depending on the version that is installed. The most reliable piece of information which does not change from version to version is the UpgradeCode.

I would like to know the best way to access the installation path of a product using it's UpgradeCode.

If I am going about this the wrong way, could you please steer me in the right direction.

Thank you,

Eric
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Finding install path using UpgradeCode

Hi Eric,
I am trying to find the installation path of a product so I can install another product in the same directory.
Is the old version build with Advanced Installer too? If Yes, during the upgrade, the installation path of the new version will be set with the path of the old installation path if the Use original installation path when upgrading option is enabled.
The most reliable piece of information which does not change from version to version is the UpgradeCode.

I would like to know the best way to access the installation path of a product using it's UpgradeCode.
In order to enumerate the products with a specified upgrade code you can use MsiEnumRelatedProducts function.

For each installed product you can use the MsiGetProductInfo function which returns product information (in your case, INSTALLPROPERTY_INSTALLLOCATION).

In order to create your custom action, you can take a look on the How to integrate and debug custom actions? article.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
InnovRick
Posts: 9
Joined: Wed May 22, 2013 4:16 pm

Re: Finding install path using UpgradeCode

Hi Dan,

Thanks for your prompt answer.

Both MSI's are built with Advanced Installer, but they are 2 different products. The second one is dependent on the first and can be seen as an add-in. It does have access to the UpgradeCode of the first product.

Your second solution using MsiEnumRelatedProducts and MsiGetProductInfo seems to be the solution I am looking for. I will try to integrate this into a Custom Action in VBScript if possible.

Eric
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Finding install path using UpgradeCode

You're welcome Eric,

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”