Adding Application Insights to your .Net Core project in Visual Studio Community for Mac

Paolo Montalto
1 min readFeb 21, 2018

Short sad story:

  • I wanted to add Application Insights to my last .Net Core project
  • Tried to follow the Quickstart guide
  • Couldn’t find the Add->Application Insights Telemetry menu item
  • End of the story

This is why I’m writing this article.

I had to figure out how to do it myself and here’s what I learnt.

First of all you will need to manually add the ApplicationInsights dependecy to your project by editing the .csproj file.
Close your project, then open your project’s .csproj file with a text editor and locate the ItemGroup containing all the PackageReference items and add the following line:

<PackageReference Include=”Microsoft.ApplicationInsights.AspNetCore” Version=”2.2.0" />

Now open your project and check that the dependecy is showing up properly in your dependencies list.

Add the instrumentation key to your appsettings.json

...
},
"ApplicationInsights": {
"InstrumentationKey": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
}
}

Finally configure Application Insights as a service in ConfigureServices of your Startup.cs as follows

services.AddApplicationInsightsTelemetry(Configuration);

That’s all folks!

This story is also available on xabaras.it (in Italian)

--

--

Paolo Montalto
Paolo Montalto

Written by Paolo Montalto

Android Engineer, freelance, mobile developer, software craftsman, guitar strummer, husband, father, humble.

Responses (2)