Search code examples
c#azureazure-functionsazure-application-insightsasp.net-core-6.0

Unable to install ApplicationInsights from Nuget for Azure Function app


I am working on an Azure Function in .NET Core 6 but I'm unable to initialize Application Insights. I tried to install `Microsoft.ApplicationInsights.AspNetCore -Version 2.20.0' but I'm unable to do so and get an exception:

enter image description here

Error:

enter image description here

I tried this command:

Install-Package Microsoft.ApplicationInsights.AspNetCore -Version 2.20.0

Solution

  • Please check if the below steps would help to fix the issue:

    1. In Visual Studio - Azure Functions Project Publish Window > Click on Restore Service dependencies and their settings icon and then Install the Microsoft.ApplicationInsights.AspNetCore.

    enter image description here

    1. Check these options are checked in VS > Tools > NuGet Packet Manager.

    Also, please check this workaround given in this SO Thread.