ASP.NET Core MVC applications stopped working after upgrading to .NET Core 1.1.1

I have one simple ASP.NET Core application that I worked on in December 2016. He did a great job with application analysis and telemetry.

Now, after 4 months, I wanted to take this job up and started by upgrading from .NET Core 1.1.0 to 1.1.1. This process package has been Microsoft.ApplicationInsights.AspNetCoreupgraded from version 1.0.2to version 2.0.0.

This, unfortunately, caused my application to stop working, in particular, I get this error:

An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.

/Views/Shared/_Layout.cshtml

'IHtmlHelper<dynamic>' does not contain a definition for 'ApplicationInsightsJavaScript' and no extension method 'ApplicationInsightsJavaScript' accepting a first argument of type 'IHtmlHelper<dynamic>' could be found (are you missing a using directive or an assembly reference?)
+
    @Html.ApplicationInsightsJavaScript(TelemetryConfiguration)

Show compilation source
#pragma checksum "/Views/Shared/_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "050a2afdfb4a44e17be72e76627a3d3a0d0b7d5a"
namespace AspNetCore
{
#line 1 "/Views/_ViewImports.cshtml"

Screen:

enter image description here

Upgrading from project.json to the new csproj and using the new Visual Studio 2017 does not help.

It looks like ApplicationInsightsJavaScript has been mostly removed from the API. How to enable javascript application display?

+4
1

ApplicationInsights 1.x 2.x, GitHub .

  • SDK .NET. .
  • UseApplicationInsightsRequestTelemetry , Startup.cs.
  • UseApplicationInsightsExceptionTelemetry , . Startup.cs, .
  • MVC JavaScript snippet , JavaScript :
    • _ViewImports.cshtml @inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration @inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
    • _Layout.cshtml @Html.ApplicationInsightsJavaScript(TelemetryConfiguration) @Html.Raw(JavaScriptSnippet.FullScript)
+15

Source: https://habr.com/ru/post/1675922/


All Articles