Search code examples
wix

Overriding text color in Wix


I am struggling to learn the wix toolset, and currently want to do something I should think would be very simple: change the color of the text displayed in the dialog boxes defined in the toolset.

I found a stackoverflow answer which said I could do this by customizing WixUI_Minimal (which is the dialog set I'm using), giving it a different ID, and referencing that ID in my main wix file. The customization would simply be to do this:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <UI Id="WixUI_Custom">
      <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
      <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
      <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" Red="255" />

And the reference in my main wxs file would be changed to:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*"
           Name="Lan History Manager"
           Language="1033"
           Version="0.5.0.0"
           Manufacturer="Jump for Joy Software"
           UpgradeCode="EB2D1FB0-A72E-466C-B12D-BCF84277E2DA">

    <Package InstallerVersion="500"
             Compressed="yes"
             InstallScope="perMachine"
             Manufacturer="Jump for Joy Software"
             Description="Installs a tool for managing Windows File History backups to network shares"
             Comments="(C) 2017 Mark A. Olbert all rights reserved"/>

    <UIRef Id="WixUI_Custom"/>

Unfortunately, this does not work. When I compile the project, it generates dozens of errors, complaining about duplicate symbols, all of which appear to relate to other parts of the WixUI_Minimal "template" which I did not change.

I do not have any definition for WixUI_Minimal present in my project, and no references are made to WixUI_Minimal, so it shouldn't be dragging in the duplicate symbols.

But something obviously is.

Is there some other way of just changing the text color in the dialogs?


Solution

  • The WiXUI_* can only be extended and overridden in limited ways. To go where you want to go you pretty much have to take a copy of it and own it. Go to the WiX sources and find the files that define all of this in the UI Extension. Clone them into your project and eliminate the UI extension. Now you can go and change anything you want about it.

    Alternatively you could also decide to go full silent in the MSI and do all your UI work in a burn bootstrapper theme and/or customer bootstrapper application.

    Update 2024: In WiX v4 and v5 it is now possible to override just a localized string. So now you can change the color without having to clone everything.