我怎样才能获得我的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
提前感谢你
答案 0 :(得分:1)
此版本存储在MSI中属性表的属性ProductVersion中。您可以轻松查询该表以获取属性值:How to read MSI properties in c#