Search code examples
azure.net-core.net-core-3.1azure-log-analyticsappinsights

What are all the nuget Packages are required for Azure App Insight


I am building a .Net Core 3.1 WebAPI and I would be deploying it on the Azure Web Service. I want to enable the App Insight

At present, I have the following nuget packages

  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.Agent.Intercept" Version="2.4.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.PerfCounterCollector" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.TraceListener" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.Web" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.WindowsServer" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" Version="2.20.0" />
    <PackageReference Include="Microsoft.AspNet.TelemetryCorrelation" Version="1.0.8" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.5" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.5" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.20.0" />
    <PackageReference Include="Microsoft.Identity.Web" Version="1.1.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
  </ItemGroup>

However, I think, I just need the following packages

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.20.0" />
    <PackageReference Include="Microsoft.Identity.Web" Version="1.1.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.20.0" />
<PackageReference Include="Microsoft.ApplicationInsights.PerfCounterCollector" Version="2.20.0" />
  </ItemGroup>

How do I know what are all the packages are required to support Azure App Insight and what is not required?


Solution

  • Thank you @VenkateshDodda-MSFT for the comment

    As per this Document,

    • For collecting logs with Application Insights in .NET Applications , we need to add the below Nuget Package
     Microsoft.ApplicationInsights.AspNetCore
    
    • After adding the Microsoft.ApplicationInsights.AspNetCore package , the below packages are added by default

    enter image description here

    • Microsoft.ApplicationInsights.WorkerService nuget package is required to enable Application Insights for background services

    Please refer What is created when you add Application Insights for more information