I'm using VS for macOS community to develop a asp.net core site and unfortunately theres no "Add Application insights telemetry".
That makes https://learn.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-core kinda not very helpful...
so, how can i hook it up manually?
You can make the changes manually. There are 3 things to be done.
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.2.1" />
Modify Program.cs to include a call to UseApplicationInsights() as shown below.
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
Add you instrumentation key - either as a parameter to UseApplicationInsights() above or in appsettings.json
{
"ApplicationInsights": {
"InstrumentationKey": "11111111-2222-3333-4444-555555555555"
}
}
Now run the application, and telemetry will start flowing to Application Insights,
These steps are described in the wiki as well: https://github.com/Microsoft/ApplicationInsights-aspnetcore/wiki/StartingDoc