Configuring NLog for your application when NLog is in the Global Assembly Cache (GAC)
If you have several applications that are using NLog, it can be a good idea to install NLog into the GAC and reference that.
A gotcha you must watch out for is caused by this piece of configuration from the NLog site:
<configuration> <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/> </configSections> <nlog> </nlog> </configuration>
Because you are not using the strong name for the Assembly-qualified name of
ConfigSectionHandler, it's impossible to do a GAC lookup, therefore NLog won't be found and you'll get an application error (even if NLog is actually in the GAC).
This means your application will throw an exception when the configuration is loaded; there will be no NLog.dll in your application folder and it can't check the GAC as it doesn't have the strong name of the assembly you want.
You can fix this by including the strong name:
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog, Version=220.127.116.115, Culture=neutral, PublicKeyToken=5120e14c03d0593c" />