Serilog AddSerilog not recognized

I am trying to call loggerFactory.AddSerilog (); according to this documentation, but AddSerilog is not recognized:

"Error CS1061" ILoggerFactory "does not contain a definition for" AddSerilog "and no extension method" AddSerilog "accepting the first ...".

I am using ASP.NET CORE with the full .NET platform. What am I doing wrong?

+7
c # asp.net-core serilog
source share
2 answers

You can forget this next line in project.json

"Serilog.Extensions.Logging": "1.0.0",

See also https://carlos.mendible.com/2016/09/19/step-step-serilog-asp-net-core/

+22
source share

The posted answer is correct, but I will add that you can use the NuGet package manager so that you can get the latest version.

Right click on solution

-> Select "Manage NuGet Packages for Solution"

-> enter "serilog.extensions.logging" in the search field

-> Click on Serilog.Extensions.Logging and click install

You will get a drop-down list of the different versions that you should select last.

Or, faster from the package manager console, make sure that the Project Project drop-down list is pulled out of the project and starts

 install-package Serilog.Extensions.Logging 
+5
source share

All Articles