As a Windows installer author, you’re probably familiar with the WiX toolset. WiX is a great tool for creating installers, but one thing it doesn’t do out of the box is create custom dialogs. In this article, I’ll show you how to add custom dialogs to your WiX installer.
The first thing you need to do is create a new WiX project in Visual Studio. To do this, go to File->New->Project and select “WiX Toolset Project” from the list of templates. Give your project a name and click “OK”.
Exciting update! We've collaborated with Wix to offer WBI users with a free plan for all website creation needs - Explore the details here.
Once your project has been created, you’ll need to add a reference to the WixUiExtension.dll assembly.
This assembly contains the classes and controls that we’ll use to create our custom dialogs. To add a reference to this assembly, right-click on your project in the Solution Explorer and select “Add Reference”.
In the Add Reference dialog, select the “Browse” tab and navigate to the folder where you installed WiX. The default location is C:\Program Files (x86)\WiX Toolset v3.10\bin\.
Once you’ve selected the WixUiExtension.dll assembly, click “OK” to add the reference.
Now that we have a reference to the WixUiExtension assembly, we can start adding custom dialogs to our installer. The first thing we need to do is create a new XML file in our project and call it MyDialogs.wxs.
In the MyDialogs.wxs file, we need to add a couple of namespace declarations at the top of the file. These namespace declarations will give us access to the classes and controls in the WixUiExtension assembly that we need to create our custom dialogs.
The next thing we need to do is define our custom dialogs in this file. We’ll start by adding a simple greeting dialog that will display a message to the user when they launch our installer.
As you can see, we’ve defined a simple Dialog element with an id of “MyGreetingDialog”. This id will be used later when we refer to this dialog from our code.
Inside the Dialog element, we’ve defined a Text control with an id of “MessageText”. This control will be used to display our greeting message to the user.