Search code examples
c#wpfdependency-injectionnugetserilog

Nuget packages should be added to each project of my solution?


In order to use Serilog I had to install multiple Nuget packages to a project. My WPF app has multiple dlls. Should I install all required Nuget packages of serilog to all projects in my solution? Also in general if my solution that has multiple projects, having common Nuget project dependencies, whether Should I install it in all projects or there is any other procedure of implementation. My app is .Net Framework 4.6 app.


Solution

  • Given you're targeting .NET Framework 4.6, I'm assuming you intend to use Serilog's ILogger to write logs.

    In that case, you need to install the package Serilog in all projects that will write to the log. This package is where ILogger is implemented, which your projects will need.

    All other packages (sinks, enrichers, etc.) need only to be installed on the project that actually configures the log (in your case, the WPF project).