I have an NLog.config which I have to point to a different database for production. Im am using this tool to transform it. Here's a part of my NLog.Config.
<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="ExceptionLog" type="Database">
<connectionString>
---- Db Connection string for test-------
</connectionString>
I have created the production transform however am not able to transform the file.
Here is what I have
<?xml version="1.0"?>
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<parameters value="Db connection for prod"
xdt:Transform="Replace" xdt:Locator="XPath(targets/target/connectionString)" />
</configuration>
We need to change the entire element rather than attribute.
Succeeded with adding the "nlog" xdt namespace alias:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"
xmlns:nlog="http://www.nlog-project.org/schemas/NLog.xsd">
<nlog:connectionString xdt:Transform="Replace"
xdt:Locator="XPath(/nlog:nlog/nlog:targets/nlog:target/nlog:connectionString)">
....put-connection-string-here....
</nlog:connectionString>
</configuration>