Web API references Microsoft.ApplicationInsights.AspNetCore that depends on a deprecated package

Angela Calborean 71 Reputation points


I have a Web API targeting .NET7. I need to send the logs to Azure and in order to configure this I need a reference to this package: Microsoft.ApplicationInsights.AspNetCore that depends on the deprecated projects.


Is there a workaround to be able to connect to Application Insights but avoid this reference?



Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,014 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
4,383 questions
{count} votes

Accepted answer
  1. AnuragSingh-MSFT 21,246 Reputation points

    @Angela Calborean , Thank you for posting this question.

    I understand that you are trying to follow the steps mentioned in the following article to configure Application Insights for your ASP.NET Core web API project- Application Insights for ASP.NET Core applications

    I see that the package mentioned in this article, Microsoft.ApplicationInsights.AspNetCore, depends on Microsoft.AspNetCore.Http which is deprecated.

    I am reaching out to our AppInsights team for clarification regarding it and will update this thread soon.

    Regarding your question, if you are only interested in capturing custom logs (for example using ILogger.LogInformation/warning etc.), you can follow the steps mentioned here - Application Insights logging with .NET. Note that it will only enable logging and no other telemetry (request, dependency, exceptions etc.).

    Another option would use Open Telemetry based instrumentation which is in preview, which has its own set of opentelemetry based packages and supports most of the scenarios covered in default package. For more details, see Enable Azure Monitor OpenTelemetry for .NET applications

    Hope this helps. I will update this thread regarding the package mentioned in question which depends on a deprecated package.

0 additional answers

Sort by: Most helpful