未设置WiX卸载UI属性

时间:2011-01-26 16:58:05

标签: wix windows-installer

我正在尝试通过卸载时使用的WiX UI设置属性。我在安装时成功完成了这项工作。序列中是否存在阻止我获取set属性的差异?似乎我的财产REMOVEDATABASES从未设置过。或许我需要发布它?以下是一些代码段。任何帮助表示赞赏。

我的财产:

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

我如何进入允许用户设置属性的对话框:

<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>

我使用该属性的对话框:

   <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>

最后,我的代码尝试使用该属性:

      <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>

谢谢, 斯科特

2 个答案:

答案 0 :(得分:3)

安装期间更改的属性和表不会保留。您可能想要执行以下操作:

The WiX toolset's "Remember Property" pattern

答案 1 :(得分:0)

您的媒体资源是否已标记为Secure(即SecureCustomProperties中列出的内容)?如果不是,则其值可能不会进入执行序列。在日志中搜索Ignoring disallowed property之类的内容应该确认或否认这一点。