Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find Application Insights dependency in docker image after dotnet publish

I'm receiving the following error when trying to run my application from a docker image:

Error: assembly specified in the dependencies manifest was not found -- package: 'Microsoft.ApplicationInsights.AspNetCore', version: '1.0.2', path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll'

The docker image is based on microsoft/aspnetcore.

The files where built using dotnet restore and dotnet publish on the docker image microsoft/aspnetcore-build:1.1.0-projectjson

Under "targets" in {app}.deps.json I have:

  "Microsoft.ApplicationInsights.AspNetCore/1.0.2": {
    "dependencies": {
      "Microsoft.ApplicationInsights": "2.1.0",
      "Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0",
      "Microsoft.AspNetCore.Http.Abstractions": "1.0.0",
      "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.1",
      "Microsoft.Extensions.Configuration": "1.0.0",
      "Microsoft.Extensions.DiagnosticAdapter": "1.0.0",
      "Microsoft.Extensions.Logging.Abstractions": "1.0.0",
      "System.Net.NameResolution": "4.3.0"
    },
    "runtime": {
      "lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll": {}
    },
    "compile": {
      "lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll": {}
    }
  },

I do not have a lib folder in my published output but I do have Microsoft.ApplicationInsights.AspNetCore at the root of my published output.

I feel like i'm missing something obvious. Any help would be appreciated.

Update:

Updating Application Insights to 2.0.0 has no effect.

Removing Application Insights simply moves the problem to another assembly.

Switching to a standalone deployment has no effect.

Added COREHOST_TRACE=1 and received the following output:

Processing TPA for deps entry [Microsoft.ApplicationInsights.AspNetCore, 2.0.0, lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll]
  Considering entry [Microsoft.ApplicationInsights.AspNetCore/2.0.0/lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll] and probe dir [/packagescache/x64]
The hash file is invalid [/packagescache/x64/Microsoft.ApplicationInsights.AspNetCore/2.0.0/Microsoft.ApplicationInsights.AspNetCore.2.0.0.nupkg.sha512]
    Skipping... match hash failed
  Considering entry [Microsoft.ApplicationInsights.AspNetCore/2.0.0/lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll] and probe dir [/packagescache]
The hash file is invalid [/packagescache/Microsoft.ApplicationInsights.AspNetCore/2.0.0/Microsoft.ApplicationInsights.AspNetCore.2.0.0.nupkg.sha512]
    Skipping... match hash failed
Error: assembly specified in the dependencies manifest was not found -- package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.0.0', path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll'
like image 866
SquishyDinosaur Avatar asked Feb 23 '17 20:02

SquishyDinosaur


1 Answers

I solved this issue by executing the application found in the publish folder. For instance, if you are publishing a .net core 1.1 app in release mode for Ubuntu 16.04, your published files will be in

\bin\release\netcoreapp1.1\ubuntu.16.04-x64

This directory has an executable in it, but that is not the executable you want to use. You actually need to go one directory deeper and use the executable in

\bin\release\netcoreapp1.1\ubuntu.16.04-x64\publish

like image 137
Greg Cobb Avatar answered Oct 20 '22 21:10

Greg Cobb