0

how can i get the version of my msi ? Version

i have tried with this:

 private void barButtonItem_Version_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            MessageBox.Show("Version" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
        }

and i have tried also:

 MessageBox.Show("Version: " + System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString());

and this code:

 Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fvi.FileVersion;

            MessageBox.Show("Version: " + version);

and this code:

  string productVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;

            MessageBox.Show("Version: " + productVersion);

and this:

 MessageBox.Show("Version: " + Application.ProductVersion);

but all of them return 1.0.0.0 as you can see on image my version is 1.0.0

thanks you in advance

user1958628
  • 409
  • 4
  • 7
  • 18

1 Answers1

1

This version is stored in the property ProductVersion from Property table in your MSI. You can query that table easily to get the property value: How to read MSI properties in c#

Community
  • 1
  • 1
Bogdan Mitrache
  • 10,536
  • 19
  • 34