I've created the following custom target:
[Target("MyTarget")
public class MyTarget : TargetWithLayout
This class is defined within its own assembly, lets say MyTargets.dll (not real name). The NLog.config file has the following lines
<extensions>
<add assembly="MyTargets, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</extensions>
A target has been defined to use this new type:
<target name="myTarget" xsi:type="MyTarget" />
A logger has been defined to use this target (omitted).
My application will successfully load the configuration if I reference the targets assembly project. If I try and reference an output DLL it will fail to load. If I programmatically add the target from the assembly (bin reference not project) then it works.
The DLLs seems to be in the right place, i.e. bin dir. The type must exist because I can reference the type in code but it seems to fall over when trying to reference the type in code.
Why not just do it in code? Well its part of a nuget package that I'm building and I want a standard configuration file distributed to all consumers of this code lib.
Any suggestions / ideas would be greatly appreciated