How can I use the default WiX property?

I am working on a set of WiX installers that are going to use a generic form. Each application needs set values, but they will be different for each application.

I am trying to allow properties (which are associated with controls) to have a default value (or not) and to allow property values ​​to be set via the command line.

in my "SharedDialog.wxs" I have:

<Fragment>
   <PropertyRef Id="PROP1"/>
   <PropertyRef Id="PROP2"/>
   <UI>
      <Dialog Id="SharedDialog" Width="370" Height="270" Title="[ProductName]">
         <Control Type="Edit" Id="1" Property="PROP1" Wid... Indirect="no" />
         <Control Type="CheckBox" Id="2" Property="PROP2" Wid...  
           CheckBoxValue="1" Indirect="no"/>
      </Dialog>
</Fragment>

      

In the application-specific file:

<Fragment>
   <Property Id="PROP1" Value="Test"/>
   <Property Id="PROP2" Value="1"/>
</Fragment>

      

This all works for what I am trying to do, but the problem is when I want to clear the values ​​like this: (so they don't have a default value)

<Fragment>
   <Property Id="PROP1"/>
   <Property Id="PROP2"/>
</Fragment>

      

I am getting this error:

Unresolved reference to symbol 'Property:PROP1' in section 'Fragment:'. 
Unresolved reference to symbol 'Property:PROP2' in section 'Fragment:'.

      

WiX also won't let you set the value to value. "The problem is, as far as I can tell, the checkbox will always check if the property has a value. How do I set the" PROP2 "property to" null "?

+3


source to share


2 answers


Nvm ... I found a solution



<Fragment>
   <Property Id="PROP1" Secure="yes"/>
   <Property Id="PROP2" Secure="yes"/>
</Fragment>

      

+1


source


  • You can override an existing property by setting it to an empty string wrapped in curly braces like this: PROPERTY = {} in a custom action set property . This means that the property does not exist, it is not an empty string. See the explanation here .
  • For properties to be available from the command line, they must be PUBLIC - they are properties that are all UPPERCASE.
  • Configuring the security of PUBLIC PROPERTIES means they can be passed from the client to the server installation process, which is required for properties that are used in deferred custom actions. Technically this adds them to the SecureCustomProperties list .
  • You can give PUBLIC PROPERTIES a default value in the properties table and then set other values ​​from the command line. The command line overrides the defaults:

    msiexec.exe / I "C: \ Test.msi" / QN / L * V "C: \ log.log" TEST = "MyValue" TEST2 = "MyValue"



More info: How to check the "unchecked" "checkbox from the msiexec command line?

+3


source







All Articles