Note that there are some explanatory texts on larger screens.

plurals
  1. POCommon Logging Could Not Load Type NLog.TargetWithLayout
    primarykey
    data
    text
    <p>I've got a Wpf .net 4.0 C# project that I am attempting to migrate from using Log4Net to using NLog as the logging library behind the Common.Logging Façade. I had expected this to be an easy task, but you know what they say, Nothing is ever easy. </p> <p>I have used NuGet to: </p> <ul> <li>Download NLog at version 2.0.1.2.</li> <li>Download Common.Logging.NLog at version 2.0.0.</li> <li>Download Common.Logging.NLog20 at version 2.1.2.</li> <li>Updated Common Logging from version 2.0.0 to version 2.1.2 using NuGet.</li> </ul> <p>In the app.config file I have:</p> <pre class="lang-xml prettyprint-override"><code>&lt;common&gt; &lt;logging&gt; &lt;factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog"&gt; &lt;arg key="configType" value="FILE" /&gt; &lt;arg key="configFile" value="~/NLog.config" /&gt; &lt;/factoryAdapter&gt; &lt;/logging&gt; &lt;/common&gt; </code></pre> <p>... and ...</p> <pre class="lang-xml prettyprint-override"><code> &lt;dependentAssembly&gt; &lt;assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" /&gt; &lt;bindingRedirect oldVersion="0.0.0.0-2.0.1.0" newVersion="2.0.1.0" /&gt; &lt;/dependentAssembly&gt; </code></pre> <p>When I run the application I get an error stating</p> <p>'The invocation of the constructor on type 'NameSpace.Shell.AppBootstrapper' that matches the specified binding constraints threw an exception.' Line number '8' and line position '18'.</p> <p>The inner exception is: </p> <blockquote> <p>{"Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."}</p> </blockquote> <p>Said Loader exception, there is one only, is:</p> <blockquote> <p>{"Could not load type 'NLog.TargetWithLayout' from assembly 'NLog, Version=2.0.1.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c'.":"NLog.TargetWithLayout"}</p> </blockquote> <p>Has anyone overcome this problem or have a work around to get <code>NLog working with Common.Logging</code>?</p> <p><em>In the interests on not posting to long of a question I have not included the <code>NLog.config</code> file but I can if it would be beneficial.</em> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload