Using this online tester , it is easy to see the following problem
I have a web.config that looks like this:
<?xml version="1.0"?>
<configuration>
<nlog/>
</configuration>
And a conversion that looks like this:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<xdt:Import assembly="AppHarbor.TransformTester" namespace="AppHarbor.TransformTester.Transforms"/>
<nlog xdt:Transform="Replace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets async="true">
<target name="LogMill" xsi:type="FallbackGroup" returnToFirstOnSuccess="true">
<target xsi:type="LogMillMessageBus"/>
<target xsi:type="File" fileName="..\LogMill-FailSafe.log" layout="${TextErrorLayout}"/>
</target>
</targets>
</nlog>
</configuration>
But the result is not what I expect, it transfers the xsi namespace declaration to the element that uses it, which leads to the fact that nlog cannot parse the configuration with an error Parameter p4 not supported on FallbackGroupTarget
<?xml version="1.0"?>
<configuration>
<nlog>
<targets async="true">
<target name="LogMill" p4:type="FallbackGroup" returnToFirstOnSuccess="true" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">
<target p4:type="LogMillMessageBus" /><target p4:type="File" fileName="..\LogMill-FailSafe.log" layout="${TextErrorLayout}" />
</target>
</targets>
</nlog>
</configuration>
Is there a conversion parameter or syntax that I can apply to prevent it from moving the namespace declaration? I did not find anything in the documentation
source
share