Wix 安装程序 - 调整致命错误对话框的大小或使用自定义对话框代替致命错误对话框 [英] Wix Installer - Resize fatal error dialog or use custom dialog in place of fatal error dialog

查看:34
本文介绍了Wix 安装程序 - 调整致命错误对话框的大小或使用自定义对话框代替致命错误对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 WiX 安装程序中 - 如何自定义或覆盖致命错误对话框 ()?我想显示详细的错误消息,而不是默认设置失败消息.

In WiX installer - How can I customize or override Fatal Error Dialog ()? I would like to show a detailed error message instead of default setup failure message.

选项:

  1. 是否可以在 WiX 中调整致命错误对话框的大小?
  2. 如果没有,我如何使用自己的对话框代替致命错误对话框?

推荐答案

要调整大小或以其他方式修改任何现有对话框,本质上您需要替换它.幸运的是,您可以从 git 存储库下载原始源代码并根据需要进行修改.

To resize or otherwise modify any existing dialog in essence you need to replace it. Luckily you can download original sources from git repository and modify them as you like.

首先要能够修改您需要覆盖默认 UI 表的任何 UI 元素.让我们修改此示例的 InstallDir UI:

Firstly to be able to modify any UI element you need to override the default UI table. Lets modify InstallDir UI for this example:

<UIRef Id="WixUI_InstallDir" />       <!-- original -->
<UIRef Id="CustomWixUI_InstallDir" /> <!-- modified -->

现在让我们通过下载源代码并更改我们想要的内容来修改 WixUI_InstallDir.我们通过在设置中添加一个新的 CustomWixUI_InstallDir.wxs 文件来做到这一点.内容可以从 WixUI_InstallDir.wxs git.

Now lets modify WixUI_InstallDir by downlaoading the source and changing what we want. We do that by adding a new CustomWixUI_InstallDir.wxs file to the setup. The contents can be downloaded from WixUI_InstallDir.wxs git.

通过在新创建的 CustomWixUI_InstallDir.wxs 文件中更改元素 UI 的 Id 属性,为此 UI 分配唯一 ID:

Assign a unique ID for this UI by changing Id attribute of element UI inside the newly created CustomWixUI_InstallDir.wxs file:

<UI Id="WixUI_InstallDir">       <!-- original -->
<UI Id="CustomWixUI_InstallDir"> <!-- modified -->

找到引用 FatalError 对话框的一行,并用您自己的致命错误对话框替换它,如下所示:

Find a line that references the FatalError dialog and replace it with your own fatal error dialog like so:

<DialogRef Id="FatalError" />        <!-- original -->
<DialogRef Id="Custom_FatalError" /> <!-- modified -->

现在我们需要再次下载 FatalError.wxs 源代码或从头开始创建它.让我们下载 FatalError.wxs 再次来自 git.并将其添加为名为 Custom_FatalError.wxs 的新安装文件.

Now we need to download FatalError.wxs source once again or create it from scratch. Lets download the FatalError.wxs source from git once again. And add it as a new setup file named Custom_FatalError.wxs.

在设置过程中出现致命错误后,仍有一个步骤可以使此对话框出现:在 Custom_FatalError.wxs 文件中找到这些行,对这个对话框进行排序并将它们替换为您自己的对话框 ID,如下所示:

There still is a step to make this dialog appear after a fatal error during the setup: Find the lines in the Custom_FatalError.wxs file, that sequence this dialog and replace them with your own dialog id like so:

原文:

  <InstallUISequence>
    <Show Dialog="FatalError" OnExit="error" Overridable="yes" />
  </InstallUISequence>

  <AdminUISequence>
    <Show Dialog="FatalError" OnExit="error" Overridable="yes" />
  </AdminUISequence>

修改:

  <InstallUISequence>
    <Show Dialog="Custom_FatalError" OnExit="error" /> <!-- note that Overridable attribute is removed -->
  </InstallUISequence>

  <AdminUISequence>
    <Show Dialog="Custom_FatalError" OnExit="error" />
  </AdminUISequence>

现在您可以按照此示例自由修改 FatalError 对话框或任何其他对话框.我个人通过修改 Description 控件在 FatalError 对话框中添加了自定义错误消息:

This is it now you can freely modify the FatalError dialog or any other dialog by following this example. I personally added a custom error message in a FatalError dialog by modifying a Description control:

<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="80" Transparent="yes" NoPrefix="yes" Text="!(loc.FatalErrorDescription1) [CUSTOMERRORMESSAGE] !(loc.FatalErrorDescription2)" />

这篇关于Wix 安装程序 - 调整致命错误对话框的大小或使用自定义对话框代替致命错误对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆