Can I look at an MSI and get the version?

M

M K

I would like to be able to have code view an MSI file and see what version
it is. This would save me from installing the app just to see if this CD has
the correct version on it. (My company is bad about labeling.) Also, I would
like my software's about box to show the version of the software without
having to change the text each time I update it.
 
F

Felix Wang

Hi Mark,

Thanks for posting.

To get a version of the MSI package, we can use the COM component
"WindowsInstaller.Installer". The following is an example in VBScript:

=================================================
'Create Installer object.
Dim Installer
Set Installer = CreateObject("WindowsInstaller.Installer")
'Open the MSI database. You may change the path information as you like.
Dim Database
Set Database = Installer.OpenDatabase("e:\setup3.msi", 0)
'Create the SQL statement for query
Dim SQL
SQL = "SELECT * FROM Property WHERE Property = 'ProductVersion'"
'Open the view and execute the SQL statement
Dim View
Set View = DataBase.OpenView(SQL)
View.Execute
'Fetch the record for the "ProductVersion" property
Dim Record
Set Record = View.Fetch
'Show the result.
MsgBox Record.StringData(2)
=================================================

For more information on automation interface on Windows Installer, you may
visit the link below:
http://msdn.microsoft.com/library/?url=/library/en-us/msi/setup/automation_i
nterface.asp?frame=true

As far as how to show the application version automatically, in fact the
application version is different from the Windows Installer package
version. Could you let me know what programming language you are using?

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top