Serilog's AddSerilog is not recognized

ashilon picture ashilon · Jul 31, 2016 · Viewed 21.8k times · Source

I'm trying to call loggerFactory.AddSerilog(); as per this documentation, but the AddSerilog method is not recognized:

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

I'm using ASP.NET CORE with the full .NET framework. What am I doing wrong?

Answer

Teerachai picture Teerachai · Sep 12, 2016

You may forget this following 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/