30

I am publishing ASP.NET Core 2 application and seeing 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. So not sure what went wrong. Any ideas on how to fix this?

Update

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

5 Answers 5

44

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: https://www.microsoft.com/net/download/all.

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

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

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.

6
  • Simply installing the runtime store did not fix the problem... however, your second option does.
    – Kram
    Jun 12, 2018 at 10:04
  • The download link was accurate at the time of posing (8 months ago). Since then, we've had multiple 2.0.x patch updates. You'll need to get the latest 2.0.x runtime store downloads from microsoft.com/net/download/all. I've updated the answer to reflect this. Jun 12, 2018 at 20:07
  • This answer only applies to 2.0.x versions. At the time of writing, 2.1.x did not yet exist. I updated the answer to reflect that it only applies to 2.0.x. Jun 25, 2018 at 16:11
  • 2
    Netcore 2.1.1 here. I used MSBuild but set the same property /p:PublishWithAspNetCoreTargetManifest=false and it did solve the problem!
    – Lam Le
    Jul 10, 2018 at 6:06
  • 1
    Second option did it Mar 11, 2020 at 3:53
14

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.

2
  • u saved my day :) Jun 27, 2018 at 10:58
  • 1
    I migrated my project from .NET Core 2.0 to .Net Core 2.1 and this solution worked for me. Jul 20, 2018 at 20:50
11

This problem 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.

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:

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

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.

1
  • This works for me too. Other solutions did not work.
    – Anil Gupta
    Jun 11, 2018 at 3:51
0

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 :

.vscode/launch.json

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.

0

I have resolved this issue by installing nuget package

"Microsoft.AspNetCore.ApplicationInsights.HostingStartup"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.