Hello! I am trying to use a couple XmlFile definitions to edit an app.config file using the WiX 3.8 toolset. I got one XmlFile working perfectly, but am getting a "Failed to find node" node error (-2147020584) with the others, but am a bit stumped as to why. I am not an XPath pro but the failing XmlFile entries are pretty much exactly like the working entry, I'm at a loss as to why one works and the others don't.
Here is a stripped down version of the app.config. I'm trying to change that appSettings/APIURL value element (working just fine), as well as the "minlevel" element in those nlog/rules/logger entries. <configuration> <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /> </configSections> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"> <targets> <target name="console" xsi:type="ColoredConsole" layout="${longdate} (${level}) [${callsite}]: ${message}" /> <target name="file" xsi:type="File" fileName="blah.log" layout="${longdate} (${level}) [${callsite}]: ${message}" /> </targets> <rules> <logger name="*" minlevel="Debug" writeTo="file" /> <logger name="*" minlevel="Debug" writeTo="console" /> </rules> </nlog> <appSettings> <add key="APIURL" value="http://localhost/API/" /> </appSettings> </configuration> My transforms are relying on these properties if it makes any difference: <?if $(var.MyApp.Configuration) = "Debug" ?> <Property Id="APIURL" Value="http://api.test.com/" /> <Property Id="NLOGLEVELFILE" Value="Info" /> <Property Id="NLOGLEVELCONSOLE" Value="Debug" /> <?else?> <Property Id="APIURL" Value="https://api.real.com/" /> <Property Id="NLOGLEVELFILE" Value="Warn" /> <Property Id="NLOGLEVELCONSOLE" Value="Info" /> <?endif ?> Here is my first XmlFile transform which is working perfectly: <Util:XmlFile Id="UpdateApiUrl" Action="setValue" File="[MainInstallFolder]MainApp.exe.config" SelectionLanguage="XPath" Permanent="yes" PreserveModifiedDate="yes" ElementPath="/configuration/appSettings/add[\[]@key='APIURL'[\]]/@value" Value="[APIURL]" /> However when I try to target those NLog settings, these are causing the "Failed to find node" errors. These three XmlFile entries are all in the same component which contains my .exe.config file. <Util:XmlFile Id="UpdateNlogFileLogLevel" Action="setValue" File="[MainInstallFolder]MainApp.exe.config" SelectionLanguage="XPath" Permanent="yes" PreserveModifiedDate="yes" ElementPath="/configuration/nlog/rules/logger[\[]@writeTo='file'[\]]/@minlevel" Value="[NLOGLEVELFILE]" /> <Util:XmlFile Id="UpdateNlogConsoleLogLevel" Action="setValue" File="[MainInstallFolder]MainApp.exe.config" SelectionLanguage="XPath" Permanent="yes" PreserveModifiedDate="yes" ElementPath="/configuration/nlog/rules/logger[\[]@writeTo='console'[\]]/@minlevel" Value="[NLOGLEVELCONSOLE]" /> I also even tried a simpler ElementPath="/configuration/nlog/rules/logger/@minlevel" but that also got "Failed to find node". The XPath query does seem to be correct, at least a couple random online XPath testing websites showed me I really was targeting what I'm trying to target. I also removed the name="*" from those logger lines in the xml config, thinking maybe that was throwing off the parsing somehow, but that didn't make any difference either. I also tried re-ordering the XmlFile entries thinking maybe the first one would work for some strange reason and all extra ones never will work, but that didn't help either. Thanks for any and all assistance! Best wishes Jeremy ------------------------------------------------------------------------------ WatchGuard Dimension instantly turns raw network data into actionable security intelligence. It gives you real-time visual feedback on key security issues and trends. Skip the complicated setup - simply import a virtual appliance and go from zero to informed in seconds. http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users