ASP.NET Core 2: missing ApplicationInsights

I am publishing ASP.NET Core 2 application and seeing the following 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:

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


I installed the SDK (I had only runtime installed) and everything started working. Not sure if this is the best solution though.


This assembly was expected to be in the local runtime store

You are getting this error because you don't 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, which is why installing the SDK fixed this. You can also install just the store, without the SDK, by downloading it here:

  2. Don't use runtime store trimming. You can disable the trimming by setting this property in your csproj file.


You can also pass this in on command line.

dotnet publish /property:PublishWithAspNetCoreTargetManifest=false

Update: June 25, 2018

This answer only applies to ASP.NET Core 2.0 projects. In ASP.NET Core 2.1, there is no runtime store anymore.

Make sure your project have matching versions for Microsoft.NETCore.App (your project target framework) and Microsoft.AspNetCore.All (NuGet dependency included by default for .NET Core 2.0 projects) or Microsoft.AspNetCore.App (for .NET Core 2.1+ projects).

If you've ever updated your project target framework from .NET Core 2.0 to .Net Core 2.1, remember to update your NuGet dependencies accordingly, as they won't got updated automatically.

This problem is discussed in great detail here: It seems to be related to updating Microsoft.AspNetCore.All to version 2.0.3 or higher in your project.

Following the above discussion it seems that for some time a solution was to install the latest .NET Core SDK on the hosting 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:


With this line ALL framework dependencies will be packed into the publishing folder! The published data of one of my projects grew from 15 Mb to 55 Mb with this switch. But at least this works, until there is a better solution.

I want to add something to @pallxk's answer. He gave me the hints to solve my issue. I'm familiar with using Visual Studio but not so familiar with VS Code.

With Visual Studio I had no issue but with VS Code as he mentioned I have to update the Nuget dependencies manually. I didn't know where to update them. They were located under my project folder in :


I have to update

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

to this

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

I hope this may help someone else to solve their issues.

Need Your Help

WP7 Invalid cross-thread access - ScheduledTaskAgent

windows-phone-7 background-process multithreading

In WP7 app I am calling some code to update a live tile from the onInvoke method on the ScheduledAgent class.

Templates spread across multiple files

c++ templates

C++ seems to be rather grouchy when declaring templates across multiple files. More specifically, when working with templated classes, the linker expect all method definitions for the class in a si...