将页面添加到安装程序 -Wix 工具集

Add pages to installer -Wix Toolset

我正在寻找一种方法来使用自己的界面向安装程序添加新页面。最终,我希望我的安装程序依次做很多事情,使用户能够转到下一页并检查或设置后续配置。

但目前我正在寻找如何在安装前添加一个附加页面 运行 并检查计算机是否具有安装该应用程序所需的程序。我想将我准备好的代码附加到 c# 以检查这些程序是否安装在给定的计算机上。

通过使用本教程: https://www.youtube.com/watch?v=6Yf-eDsRrnM&t=7195s 我创建了安装程序的基本版本。在本教程中,我们使用 WixUI_Minimal.

创建安装程序

我查看了文档,上面写着您可以创建自己的页面,但我找不到任何地方。例如那里 https://wixtoolset.org/documentation/manual/v3/wixui/ 是自定义内置 WixUI 对话框集,但他们没有说明如何做到这一点。

Overall Advice: It is generally an anti-pattern - as of this IT-epoch - to do too much with your setup GUI. In particular it is better to do per-user configuration as part of the application launch.

Rule of Thumb: You should limit setup-GUI to genuinely shared settings that need to be written with admin or elevated rights to per-machine locations (inaccessible for normal users). Set everything else from application launch. This can also help QA personnel with their testing.

Burn: Burn is the WiX toolkit's setup.exe creator. It is a bootstrapper, chainer, downloader, installer, etc... construct. . And about replacing Burn's default GUI.


WiX MSI GUI:我这里有一个关于如何更改 MSI 安装程序 GUI 的简约示例:https://github.com/glytzhkof/WiXCustomDialog。这是嵌入在实际 MSI 中的 GUI。 GUI 还有其他可能性。

GUI:您可以将每个 MSI 中的 GUI 替换为 Burn setup.exe. This GUI you can implement as a normal executable with all the bells and whistles that allows. The MSI GUI is rudimentary and old. There is another answer here on how to change installer GUI.

我维护了一个开源的 wix 创作工具,您可以通过取消注释一行 XML 来完成此操作。诀窍是在 ControlEvent table 中插入额外的行,导致现有路径被覆盖。

https://github.com/iswix-llc/iswix/blob/master/Application/IsWiXNewAddIn/MSISolutionTemplate/SetupProjectTemplate/UI.wxs

https://github.com/iswix-llc/iswix/blob/master/Application/IsWiXNewAddIn/MSISolutionTemplate/SetupProjectTemplate/UI-CustomDialog.wxs

2020 年 4 月 21 日更新

我创建了一个 public GitHub Gist,它解释了这些步骤,甚至包括一个自定义对话框 PrerequisitesDlg.wxs,最多 5 个先决条件,可以配置为 WiX 属性(文本和条件)。整个序列包含在 WixUI_KargWareFeatureTree.wxs.

2020 年 4 月 20 日之前的文本

您需要的元素是UIRef Element, Wix Toolset v3 Documentation

Wix Toolset 是一个开源项目,因此您可以在 GitHub, Wix Toolset v3 上查看它。

此处列出了嵌入 Wix 工具集中的对话框,Source Code of the Default UI-Dialoges of Wix ToolSet。我会使用 WixUI_Advanced 一个,但你可以选择所有其他的或者甚至从头开始。

  1. 从 GitHub
  2. 下载 WixUI_Advanced.wxs
  3. wxs 文件复制到您的 msi 项目的根目录(放置 *.wixproj os 的位置)并将其命名为例如MyWixToolsetPages.wxs
  4. 编辑 MyWixToolsetPages.wxs 中 UI xml 元素的 name(靠近第 50 行)
  5. MyWixToolsetPages.wxs 添加到您的 Wix 项目
  6. product.wxs中的UIRef引用元素替换或添加到<UIRef Id="WixUI_MyWixToolsetPages"/>
  7. 将新对话框添加为 <DialogRef Id="myNewPage" />
  8. 使用 Control 下一页/上一页和事件 NewDialog
  9. 自定义页面顺序
  10. 注意在两个方向(下一个、下一个、下一个、结束)和(结束、向后、向后、向后)测试你的序列

在你的 MyWixToolsetPages.wxs 中将 <UI Id="WixUI_Advanced"> 更改为 <UI Id="WixUI_MyWixToolsetPages">(从原始 WixUI_Advanced.wxs 复制而来)

...
<UI Id="WixUI_MyWixToolsetPages">
...

替换掉product.wxs里面的UIRef

...
<UIRef Id="WixUI_MyWixToolsetPages"/>
...