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.
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 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.
My question is:
How do I create a custom UI dialog that can accept user input which gets passed into runtime of the installer?
You can add custom dialogs to the UI sequence in a built-in WixUI dialog set. To do so, you must define a <UI/> element for your new dialog. Then, you must copy the contents of the <Fragment/> that includes the definition of the dialog set that you want to customize from the WiX source code to your project.
Open your WiX project in Visual Studio. Right click on your project in Solution Explorer and select Add Reference... Select the WixUIExtension. dll assembly from the list and click Add.
Have fun with UI!
Edit: 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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With