I've updated my project from .net core 2.1 to 2.2 and then logging.AddAzureWebAppDiagnostics()
in Program.cs
no longer works.
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddAzureWebAppDiagnostics();
})
.UseStartup<Startup>()
.Build();
}
'ILoggingBuilder' does not contain a definition for 'AddAzureWebAppDiagnostics' and no accessible extension method 'AddAzureWebAppDiagnostics' accepting a first argument of type 'ILoggingBuilder' could be found (are you missing a using directive or an assembly reference?
Referring to this document,
If targeting .NET Framework or referencing the Microsoft.AspNetCore.App metapackage, add the provider package to the project. Invoke AddAzureWebAppDiagnostics on an ILoggerFactory instance:
So the way might be slightly different from the previous one. How do I fix this issue?
using Microsoft.Extensions.Logging;
statement? – CouscousIf targeting .NET Core, note the following points: Don't explicitly call AddAzureWebAppDiagnostics.
– CouscousMicrosoft.AspNetCore.App
as well, that's why I referred to the statement in the document. – Burnettwill be removed in a future version.The alternative is AddAzureWebAppDiagnostics(this ILoggingBuilder builder)
– CouscousMicrosoft.Extensions.Logging.AzureAppServices
instead? – Burnett