markcvrs
Posts: 25
Joined: Tue Apr 21, 2015 9:51 am

How can get the installed ProductVersion number in C# or VB

Hi Guys,

I have an about form in my application and would like to know how I can obtain the currently installed ProductVersion number and display it. I have already managed to integrate the Update functionality as a button in my application but would like to show the user what version they currently have without them going to Control Panel etc.

Many thanks for your help on this?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How can get the installed ProductVersion number in C# or

Hello and welcome to Advanced Installer forums,

For this, you can use our predefined Product Version (identify by Upgrade Code) and Product Version (identify by Product Code) Extended Search Operations from the Search view.

If you need to retrieve the value of the property which has been assigned to the search operation then you can use the approaches from the How do I set an installer property using custom actions? article.

Other approaches would be the following:
  • 1) If the ProductVersion of the installed version is saved in the registry, then you can create a registry search operation in the Search view. Use the New Search Wizard to to quickly set up a new search, following step-by-step directions.

    2) If the ProductVersion is not saved in the registry, then you can enumerate the products with a specified upgrade code using the MsiEnumRelatedProducts function.
    For each installed product you can use the MsiGetProductInfo function which returns product information (in your case, INSTALLPROPERTY_VERSIONSTRING).
If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
markcvrs
Posts: 25
Joined: Tue Apr 21, 2015 9:51 am

Re: How can get the installed ProductVersion number in C# or

Hi there,

Thanks for that but I do really need to know how to do this in my application using C# or VB.Net. You already have sample code for Updater integration in your Knowledge base and would appreciate something similar for this kind of task?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How can get the installed ProductVersion number in C# or

Hello,

If the ProductVersion of the installed version is saved in the registry, then you can use the Registry.GetValue Method to retrieves the value associated with the specified name, in the specified registry key.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
markcvrs
Posts: 25
Joined: Tue Apr 21, 2015 9:51 am

Re: How can get the installed ProductVersion number in C# or

That is what I have subsequently done.

Thank you for your help
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How can get the installed ProductVersion number in C# or

You're welcome,

If there is anything else I can help you with, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How can get the installed ProductVersion number in C# or VB

Hi Jerry and welcome to Advanced Installer forums,

Thank you for sharing this with us. I'm sure it will help other users.

If you have any questions, please let us know.

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

Return to “Common Problems”