【问题标题】:how can i get the version of msi我怎样才能得到msi的版本
【发布时间】:2023-04-08 06:31:01
【问题描述】:

如何获取我的 msi 版本?

我试过这个:

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

我也试过了:

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

还有这段代码:

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

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

还有这段代码:

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

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

还有这个:

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

但它们都返回 1.0.0.0,正如您在图像上看到的那样,我的版本是 1.0.0

提前谢谢你

【问题讨论】:

标签: windows-installer version


【解决方案1】:

此版本存储在 MSI 属性表中的属性 ProductVersion 中。您可以轻松查询该表以获取属性值:How to read MSI properties in c#

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多