Benjamin
Benjamin

Reputation: 3826

Wix- Unable to write to XML file when using Property Name as Value

I am trying to write a value into an XML file during the installation, this value comes from a text field which user fills it during the installation stage. In my GUI file for the installer I have the following EditField:

 <Control Id="LogEdit" Type="Edit" X="45" Y="155" Width="100" Height="18"  Property="LOGVALUE" Text="{80}" />

In my Product.WXS I have added a new property like below :

   <Property Id="LOGVALUE" Secure="yes"/>
   <SetProperty Id="LOGVALUE" Value="" After="AppSearch">LogValue</SetProperty> 

And then I have created a new component like below:

<Component Id="LogComponent"
    Guid="87F682A6-1CC0-4E2D-9882-25D765478F94" Directory='ContentDir' NeverOverwrite='yes' Permanent='yes'>
  <File Id="Logconfig"
        DiskId="1"
        Name="log.xml"
        Source="..\bin\log.xml"
        Vital="yes"
        KeyPath="yes" />

  <util:XmlFile Id="SetKey3"
                Action="setValue"
                ElementPath="/log/appender[\[]@type='log4net.Appender.RollingFileAppender'[\]]/file/@value"
                Value="[LOGVALUE]"
                File="[#Logconfig]"
                SelectionLanguage="XPath"
                Sequence="1" />

</Component>

I have also added reference of this component into the . The problem is after installation nothing will be written into the XML file, However if I replace Value="[LOGVALUE]" with some hardcoded values like Value="TEST" in the util:XmlFile section it works. Any ideas where the mistake comes from?

Upvotes: 1

Views: 737

Answers (1)

tollgen
tollgen

Reputation: 219

You are setting the value of LOGVALUE to "" within the below setproperty I believe that is breaking it by setting the value to nothing, set it to "[LOGVALUE]" or don't set it at all as the UI is setting the property value

<SetProperty Id="LOGVALUE" Value="" After="AppSearch">LogValue</SetProperty>

Upvotes: 1

Related Questions