views:

366

answers:

1

Is the MSI Product Version available to the application?

I have tried, Assembly.GetExecutingAssembly().GetName().Version, but it gives me the assembly version which is a different from what I want. I can edit this value in the appropriate place, but it would be convenient if I could just show the Version Number from MSI installer.

Another point is, the MSI version number has 3 parts, each part being separated by a '.', e.g 1.0.3, where as the Assembly number has 4 parts, e.g 1.0.2.4.

From this I conclude that, we have to update these values separately and there is no way for them to be synchronized.

Is my understanding correct?

+2  A: 

The MSI is allowed to have four parts specified for its version, although it will only compare the first three (which can cause confusion when trying a minor upgrade with updates only in the fourth part). Thus you can certainly synchronize your numbers in some sort of build script if your installer solution is scriptable.

As for showing the MSI version from your application, you'd need to know your ProductCode GUID so you could MSI API to look up its version. Alternately you could write a registry entry that contains the version in a more stable location, and read that in your application.

Michael Urman