I am new to Wix and up till now I was able to manage it but now I want to update existing value of a Sub node from a config file. Below is my code to update it. But I get the error: failed to find the node.
<Component Id="ServiceIPAndPortSave" Guid="*" Directory="INSTALLFOLDER">
<CreateFolder/>
<util:XmlConfig
Id="UpdateIP"
On="install"
File="[INSTALLFOLDER]ProjectName.exe.config"
Action="create"
Node="value"
ElementPath="//configuration/userSettings/ProjectName.My.MySettings/setting[\[]@name='IPAddres'[\]]/@value"
Value="[SERVICEIP]"
/>
</Component>
And below is the format for my config file:
<configuration>
<userSettings>
<ProjectName.My.Settings>
<setting name="IPAddres" serializeAs="String">
<value>127.0.0.1</value>
</setting>
</ProjectName.My.Settings>
</userSettings>
</configuration>
Your XPATH expression is incorrect, you have two problems:
ProjectName.My.Settings
element is invalid, you are using ProjectName.My.MySettings
. value
element is invalid, you are using attribute notation. And while not incorrect, you are rooting the search from anywhere by using //
at the start of your query.
Try:
/configuration/userSettings/ProjectName.My.Settings/setting[\[]@name='IPAddres'[\]]/value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.