tags:

views:

1030

answers:

3

I have written an application in C# and I have setup a separate Setup project to create the MSI installer for the app. I was wondering if it was possible to retrieve the version of the installer and display it in the About dialog in my application.

+1  A: 

In general you would look at the version of your current assembly for this kind of stuff, finding the MSI requires a registry search to find the MSI and then some interop to pull out the version using some COM interfaces.

To get started along those lines have a look here: http://www.codeproject.com/KB/cs/msiinterop.aspx, it is a lot of work.

Instead just use:

Assembly.GetExecutingAssembly().GetName().Version;

And make sure you match your application version with your msi version.

Sam Saffron
I have done this already, but I would like to retrieve the installer version somehow. It seems like this would be a lengthy ordeal just to get the version.
arc1880
-1 Ton of work or not, this answer does not address the user's question.
emddudley
A: 

An MSI is like a database with a full API. Your version number and other releated data, live inside the MSI's database.

You could query the database using a sql like syntax.

http://msdn.microsoft.com/en-us/library/aa369426(VS.85).aspx

an example of how to query: http://msdn.microsoft.com/en-us/library/aa372021.aspx

better example and script:

http://msdn.microsoft.com/en-us/library/aa368562(VS.85).aspx

Jobo
What would I query for? I wanted to display the version number of the installer in a About dialog box.
arc1880
The installer version and other information lives inside the MSI in a database structure. You need to query MSI for it, or call one of the methods listed in the links above.
Jobo
A: 

one idea is to store the installer version in registry or predefined in application.exe.config upon installation. Later About box load the version number from there.

CallMeLaNN