ASP.NET Core 2: Missing ApplicationInsights

I am publishing an ASP.NET Core 2 application and I see the following error.

Error: An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found: package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1' path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll' This assembly was expected to be in the local runtime store as the application was published using the following target manifest files: aspnetcore-store-2.0.0-linux-x64.xml;aspnetcore-store-2.0.0-osx-x64.xml;aspnetcore-store-2.0.0-win7-x64.xml;aspnetcore-store-2.0.0-win7-x86.xml 

I did not see this error in Dev environment. Therefore, I’m not sure what went wrong. Any ideas on how to fix this?

Update

I installed the SDK (I only had runtime) and it all started. Not sure if this is the best solution.

+21
source share
4 answers

This assembly is expected to be in the local runtime repository.

You get this error because you do not have the ASP.NET Core Runtime Store installed. You have two options to fix this.

  1. Install the ASP.NET Core Runtime Store. It comes bundled with the .NET Core SDK, so installing the SDK fixed it. You can also install only a store without an SDK by downloading it here: https://www.microsoft.com/net/download/all .

  2. Do not use magazine trim at run time. You can disable cropping by setting this property in your csproj file.

  <PropertyGroup> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> </PropertyGroup> 

You can also pass this on the command line.

 dotnet publish /property:PublishWithAspNetCoreTargetManifest=false 

Update: June 25, 2018

This answer applies only to ASP.NET Core 2.0 projects. ASP.NET Core 2.1 no longer has runtime storage.

+31
source

Make sure that your project matches the versions for Microsoft.NETCore.App (the target structure of your project) and Microsoft.AspNetCore.All (the NuGet dependency is enabled by default for .NET Core 2.0 projects) or Microsoft.AspNetCore.App (for .NET Core 2 1+ projects).

If you have ever upgraded your project’s target infrastructure from .NET Core 2.0 to .Net Core 2.1, be sure to update NuGet dependencies accordingly, as they will not be updated automatically.

+12
source

This issue is discussed in great detail here: https://github.com/dotnet/coreclr/issues/13542 It seems to be related to updating Microsoft.AspNetCore.All to version 2.0.3 or higher in your project.

After the above discussion, it seems that for some time it was decided to install the latest version of the .NET Core SDK on the host machine. But at least with the current SDK 2.1.300 this did not solve the problem for me.

The solution for me was to add the following line to the .csproj of my main project:

  <PropertyGroup> <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> </PropertyGroup> 

With this line, ALL wireframe dependencies will be packaged in the publication folder! The published data of one of my projects grew from 15 MB to 55 MB with this switch. But at least it works until there is a better solution.

+10
source

I want to add something to @pallxk's answer. He gave me tips to solve my problem. I am familiar with using Visual Studio, but not very familiar with VS Code.

I had no problems with Visual Studio, but with VS Code, as he mentioned, I have to update Nuget dependencies manually. I did not know where to update them. They were in my project folder in:

 .vscode/launch.json 

I have to update

 "program": "${workspaceFolder}/Ghaseel.RestApi/bin/Debug/netcoreapp2.1/myProject.dll 

to that

  "program": "${workspaceFolder}/Ghaseel.RestApi/bin/Debug/netcoreapp2.2/myProject.dll 

I hope this can help someone else solve their problems.

0
source

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


All Articles