我正在尝试自定义wix卸载,我添加了自定义对话框,用户可以在其中选中或取消选中复选框。如果用户取消选中该复选框,则不会删除该文件。问题出在哪里,你能帮忙吗?为什么不改变房产呢?
<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>
答案 0 :(得分:1)
您无法直接在GUI中更改组件选择。此时,已经评估了条件。 您需要将组件放在一个功能中,您的控件将添加和删除功能,如本答案中所述: Wix 3.5, Install features based on checkboxes
答案 1 :(得分:0)
我已经在自定义操作的帮助下解决了这个问题,在我看来这是我看来最好的方法。
<Control Id="LeaveFiles"
Type="CheckBox"
Height="18"
Width="295"
X="26" Y="58"
Text="Not to delete custom files"
Property="CHECKBOXPROP"
CheckBoxValue="1" />
产品中的代码:
<Property Id="CHECKBOXPROP" Secure="yes">1</Property>
如果用户取消选中该复选框,则自定义操作有效:
<CustomAction Id="DeleteFolders" Directory="APPLICATIONROOTDIRECTORY" ExeCommand="cmd /C RD "./Logs" /s /q"
Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="DeleteFolders" After="RemoveFiles"><![CDATA[CHECKBOXPROP <> 1]]></Custom>
</InstallExecuteSequence>