1

I am trying to create a standalone class library for logging (named "Logger") purposes across different projects.

I have created a solution with a class project, and in this class, I have installed NuGet package for NLog, and for one extension for a GrayLog target to NLog. (In the Logger project)

I created 2 more projects (a test one and a console one) and I referenced the first project (Logger) to both of them.

Project structure The problem is, if I try to run it (from Console or from Test), get me an exception from NLog, that cannot load the DLL for the extension.

Exception 1 Exception 2

Do you have any idea? I have tried to change all projects to .Net 4 instead of 4.6.2 because the NLog extension was made with version 4, but still same issues.

Thanks in advance.

SirMartin
  • 148
  • 1
  • 7
  • If I remove the target from the extension from the NLog.config file works fine. – SirMartin Oct 23 '18 at 09:24
  • 1
    I dont' think it is an issue with NLog, but it is an issue with "satellite" dependencies from the shared project is not copied into the output-folder of your ConsoleApp1- and Logger.Tests-projects. Try to add a direct reference to NLog.Targets.Gelf from these two projects to see if it works. I can recommend upgrading to the VS2017-csproj format with PackageReference, where dependency-references works a lot better. – Rolf Kristensen Oct 23 '18 at 17:46
  • I am working with VS 2017, if I reference everything in the same project works, but not if are different, but I don't want to copy the extension to all the projects. At the moment I tried with .net core, and worked fine. So I am not sure is a special incompatibility from this specific extension, or what, because for .net core I am using another one. – SirMartin Oct 25 '18 at 07:34

0 Answers0