如何在 WiX 中为用户输入创建自定义对话框? [英] How do I create a custom dialog in WiX for user input?

查看:16
本文介绍了如何在 WiX 中为用户输入创建自定义对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WiX 为 Windows 服务创建安装程序.安装并显示在服务中的服务名称最好在安装时进行配置.

I'm using WiX to create an installer for a windows service. It's desirable that the name of service that gets installed and displayed in Services is configurable at install time.

例如,这就是我的想法(wix xml snip):

For example, this is what I'm thinking (wix xml snip):

<ServiceInstall 
    Id="MyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Type="ownProcess" 
    Start="auto" 
    ErrorControl="normal" 
    Description="My Service" 
    Account="localsystem"/> 

<ServiceControl
    Id="StartMyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Start="install"
    Wait="no" />

<ServiceControl
    Id="StopMyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Remove="uninstall"
    Stop="both"
    Wait="yes" />

NAME_PASSED_FROM_DIALOG 是我想连接到一个自定义对话框的东西,该对话框被创建并显示给安装服务的人,以便他们可以设置/修改服务名称.我认为这与设置并传递给 WixUI_InstallDir 对话框集的 WIXUI_INSTALLDIR 属性非常相似.

NAME_PASSED_FROM_DIALOG is something I would like to hook up to a custom dialog that gets created and gets displayed to the person installing the service so they can set/modify the service name. I think this is very similar to the WIXUI_INSTALLDIR property that gets set and passed to the WixUI_InstallDir Dialog Set.

我的问题是:

如何创建一个自定义 UI 对话框来接受传递到安装程序运行时的用户输入?

How do I create a custom UI dialog that can accept user input which gets passed into runtime of the installer?

推荐答案

玩得开心!

答案的原始链接不再存在.FireGiant(Wix 的维护者)一些示例过程,但它并没有完全回答这个问题.还有一个教程(2018 年 8 月更新:链接从 Wayback Machine 复活)确实可以回答这个问题.

The original link to answer doesn't exist anymore. FireGiant (the maintainers of Wix) some examples for part of this process, but it's doesn't completely answer this question. There is one further tutorial (UPDATE Aug.2018: Link resurrected from Wayback Machine) that does go most of the way to answer this question.

将要发生的事情的高级概述是:

A high level overview of what will be happening is:

  1. 创建属性
  2. 让 UI 控件设置此属性
  3. 服务上的名称属性将引用该属性,即[ServiceNameProperty].

但这很复杂,建议创建新 UI 对话框的方法是获取现有对话框,对其进行克隆,然后使用新文本、控件进行编辑并使用它来填充属性.

However this is complex, and the way that is suggested to create a new UI dialog, is to take an existing dialog, make a clone of it, and then edit with new text, controls and use it to populate the property.

这篇关于如何在 WiX 中为用户输入创建自定义对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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