corentinaltepe / nlog.loki

NLog target for Loki using an HTTP client
BSD 3-Clause "New" or "Revised" License
22 stars 7 forks source link

Nlog.Loki.dll is not copied to bin directory when used as a sub project #114

Open KevCenturion opened 6 months ago

KevCenturion commented 6 months ago

Hi, Thanks for creating this. We have created a shared logging library in .NET Framework 4.8 which references Nlog.Loki.dll 2.1.1

We have setup a parent solution and sub projects.

Solution

Everything works fine if we have a reference to Loki in Project B and the Nlog.Loki.dll is copied to the bin directory of project B.

If the Loki reference is removed from Project B, then the Nlog.Loki.dll is not copied to the bin directory. It is marked as CopyLocal in the ProjectA project. NLog 5 works as expected and is copied to Project B bin directory although there is not reference to it in Project B.

It appears to be something to do with the Loki dll being .netstandard 2.0, I've tried various stackoverflow suggestions like

https://stackoverflow.com/questions/70082582/net-standard-dependency-not-copied-to-output-directory

However the loki dll will not be copied unless it's added as a reference (Verbose build output) show's nothing helpful.

Anyone encountered this?

corentinaltepe commented 6 months ago

Hi, I'm not very familiar with .NET Framework NuGet dependencies configurations, and how transitive dependencies are configured. Would explicitly defining a dependency to NLog.Targets.Loki solve the issue? But then, users of your library would need to include both your library and NLog.Targets.Loki.

Would publishing the NuGet package explicitly targetting .NET Framework 4.8 solve the issue? We could try that out. Would you like to give it a try to see if it solves your issue? If so, I can update the build and publish scripts accordingly.

KevCenturion commented 5 months ago

Thanks for the response, yes I believe publishing explicitly for .net 4.8 would fix the issue!