Programatically reading .msi build version

I'm creating a web site from which to download msi-files, and I want to "query" the .msi files for version information. (Note that I'm after the install kit version, not the version of files inside the install kit)

Specifically I want to be able to query the site from an application to check if there is a newer version of an install kit available for download, and I want a web page to display the version number of an msi-file available on the site.

I gave wrapping MsiGetFileVersion in msi.dll a quick try, but it doesn't give me anything. Might be that the below method is not the one I want.

Any ideas?



[DllImport("msi.dll", CharSet = CharSet.Unicode)]
extern static public uint MsiGetFileVersion(string path, StringBuilder version,
			ref uint versionSize, StringBuilder language, ref uint languageSize);

Open in new window

LVL 4
alaranAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alaranAuthor Commented:
Not to worry, I got it.

Here's some sample code it anyone's interested.

WindowsInstaller.Installer inst = (Installer) Activator.CreateInstance(Type.GetTypeFromProgID("WindowsInstaller.Installer"));
 
Database db = inst.OpenDatabase(Server.MapPath("PulseClientSetup.msi"), 0);
string query = "select * from Property where Property = 'ProductVersion'";
WindowsInstaller.View view = db.OpenView(query);
view.Execute(null);
Record record = view.Fetch();
 
string version = record.get_StringData(2);
 
Response.Write("Version: " + version);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alaranAuthor Commented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.