WIX installer: cannot install more than one appSettings node

In the wix installer, I have the following:

<util:XmlFile Id="leID4" File="[INSTALLFOLDER]app.config" Sequence="5"
                      Action="setValue" ElementPath="/configuration/appSettings/add[\[]@key='JobProcessorTimerInterval'[\]]/@value" Value="60000" Permanent="yes" />

<util:XmlFile Id="leID5" File="[INSTALLFOLDER]app.config" Sequence="6"
                      Action="setValue" ElementPath="/configuration/appSettings/add[\[]@key='FromEmail'[\]]/@value" Value="[FROMEMAIL]" Permanent="yes" />

      

This is my app.config file:

<configuration>
<appSettings>
    <add key="FromEmail" value="test@hotmail.com" />
    <add key="JobProcessorTimerInterval" value="60000"/>
</appSettings>
</configuration>

      

When I run the installer, I get this message:

enter image description here

I've tried several ways, but I can't seem to get this to work. Can anyone see where I am going wrong?

+3


source to share


1 answer


Can you try one below? The WIX documentation states that:

"setValue - Sets the value in the element specified by ElementPath. The name is specified, and the attribute with this name is set to the value specified in Value. If name is not specified, the text value of the element is set. Value is a required attribute if setValue is an action specified."



    <util:XmlFile Id="leID4" 
                        File="[#filename]" 
                        Sequence="5"
                        Action="setValue" 
                        ElementPath="//appSettings/add[\[]@key='JobProcessorTimerInterval'[\]]" 
                        Name="value" 
                        Value="60000" 
                        Permanent="yes" 
                        SelectionLanguage="XPath" />

    <util:XmlFile Id="leID5"
                        File="[#filename]" Sequence="6"
                        Action="setValue" 
                        ElementPath="//appSettings/add[\[]@key='FromEmail'[\]]" 
                        Name="value" 
                        Value="[FROMEMAIL]" 
                        Permanent="yes" 
                        SelectionLanguage="XPath" />

<File Id="filename" Name="xmlfiletest" Source="..\\xmlfile1.xml">
          </File>

      

filename is the ID attribute of the FILE element in your WIX for the app.config file.

+2


source







All Articles