0

I am trying to customize wix uninstall, I've added custom dialog where user can check or uncheck checkbox. If user unchecks the checkbox, the file is not removed. Where is the problem, could you help? Why does not it work for changing the property?

  <UI>
  <Dialog Id="UninstallDlg" Width="370" Height="270" Title="!(loc.WelcomeDlg_Title)">
    <Control Id="NextB" Type="PushButton" X="248" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
    <Control Id="BackB" Type="PushButton" X="192" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />

    <Control Id="FullDelete"
         Type="CheckBox"
         Height="18"
         Width="295"
         X="26" Y="58"
         Text="Not to delete custom files"
         Property="FULLUNINSTALL"
         CheckBoxValue="1" />

    <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.CustomizeDlgBannerBitmap)" />
    <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="2" />
    <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="2" />
    <Control Id="Title" Type="Text" X="15" Y="6" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.CustomizeDlgTitle)" />
  </Dialog>
</UI>


<Component Id="FullDelete" Guid="{469E4DE7-A031-449F-8B75-D4CBC94F88B6}">
        <Condition>FULLUNINSTALL = 0</Condition>
        <RemoveFile Id="RemoveDatabase" Name="*.sdf" On="uninstall"/>
      </Component>


<Property Id="FULLUNINSTALL" Secure="yes">1</Property>
Lili
  • 57
  • 1
  • 7

2 Answers2

1

You can't change component selection directly in the GUI. At this point, conditions already evaluated. You will need to put your component in a feature and your controls will add and remove feature like explained in this answer : Wix 3.5, Install features based on checkboxes

Community
  • 1
  • 1
efficks
  • 139
  • 13
0

I have solved this problem with a help of custom actions, in my case it is the best way as it seems to me.

<Control Id="LeaveFiles"
         Type="CheckBox"
         Height="18"
         Width="295"
         X="26" Y="58"
         Text="Not to delete custom files"
         Property="CHECKBOXPROP"
         CheckBoxValue="1" />

And code in product:

<Property Id="CHECKBOXPROP" Secure="yes">1</Property>

If user unchecks the checkbox, the custom action works:

  <CustomAction Id="DeleteFolders" Directory="APPLICATIONROOTDIRECTORY" ExeCommand="cmd /C RD &quot;./Logs&quot; /s /q"
              Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />

<InstallExecuteSequence>
  <Custom Action="DeleteFolders" After="RemoveFiles"><![CDATA[CHECKBOXPROP <> 1]]></Custom>
</InstallExecuteSequence>
Lili
  • 57
  • 1
  • 7
  • With this solutions, you will lost track of installed files in the MSI database. – efficks Nov 14 '14 at 15:34
  • What track should I check? I am not sure about your answer, but installer works fine, as for bootstrapper, it doesn't want to start my custom dialogs, just install like from programs and features – Lili Nov 18 '14 at 04:25