3

'ILoggingBuilder' does not contain a definition for 'AddEventSourceLogger' and no accessible extension method 'AddEventSourceLogger' accepting a first argument of type 'ILoggingBuilder' could be found

    Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(args)
            .ConfigureLogging(logging =>
        {
            // Requires `using Microsoft.Extensions.Logging;`
            // logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
            logging.AddConsole();
            logging.AddDebug();
            logging.AddEventSourceLogger();
        })
        .UseApplicationInsights()
        .UseStartup<StartupConsole>()
        .UseDefaultServiceProvider(options => options.ValidateScopes = false);

I am currently using .net-core 2.1 and have nuget for using Microsoft.Extensions.Logging installed.

1 Answers1

4

Make sure you have installed the Microsoft.Extensions.Logging.EventSource NuGet package.

Reference: Logging in .NET Core and ASP.NET Core

crgolden
  • 4,332
  • 1
  • 22
  • 40