如何在 WIX 中的 MSI 安装程序标题中显示版本号?

How to show version number in title of MSI installer in WIX?

我只想在标题中显示版本号,而不是在其他任何地方。甚至不在 "Welcome to the XYZ setup wizard" 行中。通过更改产品线中的名称<Product Name="$(var.productName) $(var.ProductVersion)"...> 有很多副作用。有人可以帮我解决这个问题吗?

String Override:如果您指的是顶部的标题栏(请参见下面的屏幕截图),您可以尝试覆盖string id "WelcomeDlg_Title"(相对于 WelcomeDlgTitle - 是的,它们是不同的,仔细看) - 这样做是为了all string entries_Title:

结尾
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">

  <...>

  <String Id="WelcomeDlg_Title">[ProductName] - [ProductVersion]</String>

  <String Id="SetupTypeDlg_Title">[ProductName] - [ProductVersion]</String>
  <String Id="WelcomeEulaDlg_Title">[ProductName] - [ProductVersion]</String>
  <String Id="BrowseDlg_Title">[ProductName] - [ProductVersion]</String>
  <String Id="CancelDlg_Title">[ProductName] - [ProductVersion]</String>
  <String Id="CustomizeDlg_Title">[ProductName] - [ProductVersion]</String>
  <String Id="LicenseAgreementDlg_Title">[ProductName] - [ProductVersion]</String>
  <String Id="VerifyReadyDlg_Title">[ProductName] - [ProductVersion]</String>
  <String Id="WaitForCostingDlg_Title">[ProductName] - [ProductVersion]</String>

  <...etc...>

</WixLocalization>

总结:您只需要做以下事情:

  • 正常设置WiX工程,添加UI支持:WixUIExtension.dll
  • 添加本地化文件(适用于任意数量的语言)
  • 在所有本地化文件中覆盖此字符串 ID 并注入版本 [ProductVersion]

现有答案:与其重复整个过程,请参阅此答案:How show version number in title of installation in WIX?