title: ASP.NET MVC - NLog file target not found
body: <p>I have a problem with NLog.
  I have configured the NLog in the file Nlog.config as following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        autoReload="true"
        throwExceptions="true"
        internalLogLevel="Trace"
        internalLogFile="d:\temp\nlog-internal.log"&gt;
  
    &lt;target xsi:type="File" name="log" fileName="${basedir}\logs\${date:format=dd}.log"
          layout="${longdate} ${uppercase:${level}} ${message}" /&gt;
  
  
    &lt;rules&gt; 
      &lt;logger name="*" minlevel="Debug" writeTo="log" /&gt;
  
    &lt;/rules&gt;
  &lt;/nlog&gt;
  </code></pre>
  
  <p>And I get an error that <strong>target log is not found</strong>. I really don't know what I can do, maybe someone had similar problem.</p>
  
  <p>I'm using .NET 4.5.</p>
  
  <p>The Nlog.config is in the main directory of the project.
  I set up the permissions to full access in the directories.</p>
  
  <p>I tried to move the configuration into the web.config file, but the error still appear.</p>
  
  <pre><code>2016-07-26 09:17:25.6353 Warn Skipping unknown node: target
  2016-07-26 09:17:25.6353 Trace ParseRulesElement
  2016-07-26 09:17:25.6623 Error Error in Parsing Configuration File. Exception: NLog.NLogConfigurationException: Exception occurred when loading configuration from D:\Project\NLog.config ---&gt; NLog.NLogConfigurationException: Target log not found.
     w NLog.Config.XmlLoggingConfiguration.ParseLoggerElement(NLogXmlElement loggerElement, IList`1 rulesCollection)
     w NLog.Config.XmlLoggingConfiguration.ParseRulesElement(NLogXmlElement rulesElement, IList`1 rulesCollection)
     w NLog.Config.XmlLoggingConfiguration.ParseNLogElement(NLogXmlElement nlogElement, String filePath, Boolean autoReloadDefault)
     w NLog.Config.XmlLoggingConfiguration.ParseTopLevel(NLogXmlElement content, String filePath, Boolean autoReloadDefault)
     w NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fileName, Boolean ignoreErrors)
  </code></pre>
  
  <p>Structure of the project:</p>
  
  <p><a href="https://i.stack.imgur.com/FB2gK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FB2gK.png" alt="Structure"></a></p>
  
  <p><strong>Update (after Michel A. answer):</strong> I have also properties in NLog.config file</p>
  
  <pre><code>Build Action = Content
  Copy to Output Directory = Copy always
  </code></pre>
  
  <p><strong>Update2:</strong> I found the solution. The problem was that I have the backslashes instead of forward slashes</p>
  
  <p>Wrong syntax:</p>
  
  <pre><code>fileName="${basedir}\logs\${date:format=dd}.log"
  </code></pre>
  
  <p>Correct syntax:</p>
  
  <pre><code>fileName="${basedir}/logs/${date:format=dd}.log"
  </code></pre>