To let people know what version of the program they are using, i want to show the productversion in the title of the window. I can do that manually, but i want this to be dynamic, so i don’t have to change both items everytime the version changes.
Is this possible doing this in code behind without messing with the installer?
You can retrieve the version from the
AssemblyName.Versionproperty using the following code:Update (after comment):
You can also read the version of the setup from the MSI information stored in the Registry. This is best done based on the UpgradeCode specified by your setup as the UpgradeCode should not change between versions. The following sample program demonstrates how to get the installed version(s)1 belonging to a specific UpgradeCode:
1Note that there might be several versions of one product be installed in parallel. In that rare case you would get a list with all installed versions.