Doo Dah
Doo Dah

Reputation: 4029

WiX uninstall UI property not set

I am trying to set a property via a WiX UI that is used at uninstall time. I have done this successfully at install time. Is there a difference in the sequence that is preventing me from getting the set property? It seems that my property, REMOVEDATABASES is never set. Or perhaps I need to publish it? Here are some code snippets. Any help is appreciated.

My property:

<Property Id="REMOVEDATABASES" Value="0" />

How I get to the dialog that allows the user to set the property:

<UI Id="WixUI_App">
  ...
  <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

  <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

  <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="SetConfigurationUnInstallDlg">1</Publish>
  <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
   ...
</UI>

My dialog that uses the property:

   <Dialog Id="SetConfigurationUnInstallDlg" Width="370" Height="270" Title="Uninstall option">
    <Control Id="NextUninstall" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)"  >
      <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
    </Control>
    <Control Id="BackUninstall" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" >
      <Publish Event="SpawnDialog" Value="MaintenanceTypeDlg">1</Publish>
    </Control>
    <Control Id="CancelUninstall" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
      <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
    </Control>

     ....

    <Control Id="UnistallDBLabel" Type="Text" X="20" Y="60" Width="80" Height="14" NoPrefix="yes" Text="Unistall Database?" />
    <Control Id="RadioButtonGroupID" Type="RadioButtonGroup" X="20" Y="58" Width="305" Height="100" Property="REMOVEDATABASES" Text="Remove Databases?" Default="no">
      <RadioButtonGroup Property="REMOVEDATABASES">
        <RadioButton Value="0" X="100" Y="0" Width="200" Height="10" Text="No" />
        <RadioButton Value="1" X="100" Y="20" Width="200" Height="10" Text="Yes" />
      </RadioButtonGroup>
    </Control>
  </Dialog>

And, finally, my code that tries to use the property:

      <Component Id="cmpDatabaseUnInstall" Guid="B6D21CE5-9470-4D78-8760-E9AE04A91AB4"  KeyPath="yes">
    <Condition>REMOVEDATABASES = "1"</Condition>
    <sql:SqlDatabase Id="masterDB" Server="[SERVER]" Instance="[INSTANCE_NAME]" Database="master"
                   CreateOnInstall="no" ConfirmOverwrite="yes" DropOnUninstall="no" ContinueOnError="no"
                   CreateOnReinstall="no" CreateOnUninstall="no" DropOnInstall="no" DropOnReinstall="no">
    </sql:SqlDatabase>
    <sql:SqlScript Id="DropAllDatabases"
                   SqlDb="masterDB" BinaryKey="DropAllDatabases"
                   ContinueOnError="yes" ExecuteOnInstall="no" ExecuteOnReinstall="no" ExecuteOnUninstall="yes"
                   Sequence="1"/>
  </Component>

Thanks, Scott

Upvotes: 2

Views: 3420

Answers (2)

Michael Urman
Michael Urman

Reputation: 15905

Is your property marked Secure (i.e. listed in SecureCustomProperties)? If not, its value may not make it to the execute sequence. Searching the log for something like Ignoring disallowed property should confirm or deny this.

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55620

Properties and Tables changed during an installation are not persisted. You probably want to do the following:

The WiX toolset's "Remember Property" pattern

Upvotes: 3

Related Questions