Wix does not set property value based on checkbox

2019-07-18 12:55发布

I have inside my MyVerifyReadyDlg.wxs checkbox control defined as following:

      <Control Id="REMOVELOGSFILESCHECKBOX" Type="CheckBox" X="170" Y="170" Width="80" Height="17"
            Property="REMOVINGLOGSPROPERTY" CheckBoxValue="0" Text="Remove logs files">
      <Condition Action="show">Installed</Condition>
      <Condition Action="hide">NOT Installed</Condition>
    </Control>

and inside Product.wxs I have defined the property as:

<Property Id="REMOVINGLOGSPROPERTY" Secure="yes"/>

and also inside Product.wxs I have this component to remove a log files on uninstall:

  <Component Id="logsFolderComponent" Guid="*" Directory="logsFolder">
  <Condition>REMOVINGLOGSPROPERTY</Condition>
  <RemoveFile Id="allLogsFiles" Name="*.log" On="uninstall"></RemoveFile>
 </Component>

The problem is: it does not set the property(stays null) when I check the checkbox during an uninstallation, but if I use the checkbox on installation it removes the log files.

How I can set the property on uninstall?

1条回答
贼婆χ
2楼-- · 2019-07-18 13:03

Properties aren't automatically preserved anywhere between install and later operations. WiX provides the "remember property" pattern for this.

http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/

查看更多
登录 后发表回答