I'm trying to transform one config to another.
This is my Web.config
<?xml version="1.0"?><configuration><appSettings><add key="ini" value="" /><add key="currentDirectory" value="" /><add key="invoiceLifeTime" value="30" /><add key="archiveMode" value="0" /><add key="ClientSettingsProvider.ServiceUri" value="" /><add key="ClientSettingsProvider.ConnectionStringName" value="DefaultConnection" /></appSettings><connectionStrings><add name="foo" connectionString="value"/></connectionStrings></configuration>
This is my Transform Web.Debug.config
<?xml version="1.0"?><configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"><configSections xdt:Transform="MergeBefore(/configuration/*)" /><configSections><section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" xdt:Transform="Insert" /></configSections><nlog xdt:Transform="MergeBefore(/configuration/connectionStrings/*)" /><nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" xdt:Transform="Insert"><targets><target name="file" xsi:type="File" fileName="./log/logfile.txt" encoding="iso-8859-2" /></targets><rules><logger name="*" minlevel="Debug" writeTo="file" /></rules></nlog></configuration>
This is the Result
<?xml version="1.0"?><configuration><configSections><section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /></configSections><appSettings><add key="ini" value="" /><add key="currentDirectory" value="" /><add key="invoiceLifeTime" value="30" /><add key="archiveMode" value="0" /><add key="ClientSettingsProvider.ServiceUri" value="" /><add key="ClientSettingsProvider.ConnectionStringName" value="DefaultConnection" /></appSettings><connectionStrings><nlog /><add name="foo" connectionString="value" /></connectionStrings><nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd"><targets><target name="file" p4:type="File" fileName="./log/logfile.txt" encoding="iso-8859-2" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance" /></targets><rules><logger name="*" minlevel="Debug" writeTo="file" /></rules></nlog></configuration>
Why xdt:Transform does not break lines in "nlog" xml tree? How to make it work to look the same as in Web.Debug.config with correct looking xml tree. Is there a way to add line breaks when transforming with xdt:Transform?