I have a web project (ASP.NET MVC 4 project) that has a number of configurations stored in Web.Config and in NLog.config files.
I have
It appears that I am quite late on this, but I have found that it is necessary for the NLog.config file to have the following:
...
...
And the NLogTransform.config file (or whatever name it may have) to have the following:
...
...
Here is some sample code to test the NLog transformation:
var tmpConfigFile = new FileInfo("C:\\NLogs\\NLog.config");
var transformFile = new FileInfo("C:\\Transforms\\NLogTransform.config");
if (transformFile.Exists) {
var xmlTransformableDocument = new XmlTransformableDocument();
xmlTransformableDocument.Load(tmpConfigFile.FullName);
var xmlTransformation = new XmlTransformation(transformFile.FullName);
xmlTransformation.Apply(xmlTransformableDocument);
xmlTransformableDocument.Save(tmpConfigFile.FullName);
}