Search code examples
c#wixwindows-installercustom-action

Showing WiX dialog from a C# custom action during uninstall


I'm having trouble displaying a dialog during the uninstall sequence that runs from the shortcut and add/remove programs with basic UI. It seems to be skipping the InstallUISequence that is shown during modify and install:

<!--Displays uninstall options before uninstall progress dialog WixUI_InstallMode = "Remove"-->
<InstallUISequence>
    <Show Dialog="UninstallDialog" Before="ProgressDlg">WixUI_InstallMode = "Remove"</Show>
</InstallUISequence>

However, it is important I get this dialog running during the basic uninstall sequence as well. Is it possible to show dialogs defined in WiX from the C# custom action run from the InstallExecuteSequence? If so, how would I go about doing this? Are there any tutorials? The dialog I would like to show can be seen below:

<!--Dialog used to obtain uninstall options from user-->
<Dialog Id="UninstallDialog" Width="120" Height="100" Title="Options">
    <Control Id="DelDatabaseCheckBox" Type="CheckBox"
             X="15" Y="10" Width="90" Height="17" Property="DELDATABASE"
             CheckBoxValue="1" Text="Delete Database"/>

    <Control Id="DelSettingsCheckBox" Type="CheckBox"
             X="15" Y="30" Width="90" Height="17" Property="DELSETTINGS"
             CheckBoxValue="1" Text="Delete Settings"/>

    <Control Id="DelErrorLogCheckBox" Type="CheckBox"
             X="15" Y="50" Width="90" Height="17" Property="DELERRORLOG"
             CheckBoxValue="1" Text="Delete Error Log"/>

    <Control Id="ConfirmUninstall" Type="PushButton" X="22" Y="75" Width="70" Height="17" Text="Ok">
        <Publish Event="EndDialog" Value="Return">1</Publish>
    </Control>
</Dialog>

Solution

  • What you are trying to do is an antipattern. Instead disable the Remove button and force the user to go through the Change | Remove story. You can display native MSI UI there.