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.
views:
1030answers:
3In 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.
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
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.