简体   繁体   English

如何在WIX安装程序中嵌入UserControl?

[英]How to embed a UserControl in WIX installer?

Is there anyway to embed a usercontrol inside a WIX installer? 无论如何,是否可以将用户控件嵌入WIX安装程序中?

We're trying to replace an InstallShield installer with a WIX installer, however there are a couple of involved UserControls that the InstallShield installer embeds that would be easier to reuse than reimplement. 我们正在尝试用WIX安装程序替换InstallShield安装程序,但是InstallShield安装程序嵌入了一些涉及的UserControl,它们比重实现更容易重用。

As far as I know, it is not possible to embed user controls inside Wix installers. 据我所知,不可能将用户控件嵌入Wix安装程序中。 This is because Wix simply outputs a standard Windows Installer MSI file, and that only supports limited types of controls . 这是因为Wix仅输出标准的Windows Installer MSI文件,并且仅支持有限类型的控件

That being said, you might want to look out for Burn , a newcomer to the Wix toolset expected later this year, which is likely to include support for custom UIs on top of Windows Installers. 话虽这么说,您可能要注意Burn ,它是今年晚些时候有望出现的Wix工具集的新成员,它可能包括对Windows Installer之上的自定义UI的支持。

There is nothing stopping you from having a custom action that displays a form, and having this custom action triggered when a button is pressed. 没有什么可以阻止您执行显示表单的自定义操作,以及按下按钮时触发此自定义操作。

I have used this approach with great success to implement "picker controls". 我已经成功地使用了这种方法来实现“选择器控件”。 For example, have a text box with a button next to it, and when the button is clicked you display the standard AD "find user" dialog. 例如,有一个文本框,旁边有一个按钮,单击该按钮后,将显示标准的AD“查找用户”对话框。

Or create a form that uses SMO to enumerate all the SQL Servers on the network and allow the user to pick one (and then enumerate the DBs on the server for them to pick). 或创建一个使用SMO枚举网络上所有SQL Server并允许用户选择一个表单的表单(然后枚举服务器上供他们选择的DB)。

So you could create a custom action that displays a form, and then host your user control in the form. 因此,您可以创建一个显示表单的自定义操作,然后在表单中托管用户控件。

That being said, I await the release of Burn with great anticipation. 话虽这么说, 我期待着Burn的发行。

While you can wait for Burn (as mentioned in the other answers) you can also check out a program of mine called SharpSetup - it allows you to create installation logic using WiX (files, folders, registry entries, etc.) but create whole user interface using WinForms. 虽然您可以等待Burn(如其他答案所述),但是您也可以签出一个名为SharpSetup的程序-它允许您使用WiX创建安装逻辑(文件,文件夹,注册表项等),但可以创建整个用户使用WinForms的界面。 This gives you great flexibility in what controls you can use (basically everything you have on VS toolbar), including custom UserControls. 这使您可以灵活使用哪些控件(基本上是VS工具栏上的所有控件),包括自定义UserControls。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM