Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Version Number (Installer Version)

I’m trying to add a feature to my winforms app that prints the version number on the main screen. I currently have this:

txtVersion.Text = ProductVersion.ToString();

Which tells me the version of the program – all well and good.

However, what I’d ideally like it to do is to pick up the version of the installer program that was used to create the msi. Is there a way to either interrogate this from within the installed program, or to transfer the information during installation somehow?

like image 486
Paul Michaels Avatar asked Aug 06 '10 11:08

Paul Michaels


2 Answers

It sounds like you want the ProductVersion property. You can get that at run time by calling the ::MsiGetProductInfo() function providing the ProductCode for the MSI that installed you.

If doesn't work out for you, then writing the ProductVersion to a registry key and reading that at run-time is fairly popular. You can use that registry key to solve the ICE38 troubles described here as well: http://robmensching.com/blog/posts/2007/4/27/How-to-create-an-uninstall-shortcut-and-pass-all-the

like image 56
Rob Mensching Avatar answered Oct 21 '22 17:10

Rob Mensching


It's better not take app version from installer, but take installer version from app (AssemblyInfo.cs), imo.

like image 44
abatishchev Avatar answered Oct 21 '22 17:10

abatishchev