Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An assembly specified in the application dependencies manifest was not found

So I have a .NET Core 2.2 web application. I added the EPPlus library to it and now, when it is released to Azure (App Service) it won't start and I get the error:

HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

I narrowed this down by running a console in Azure and the command: "dotnet my.project.dll" - and got the actual error:

An assembly specified in the application dependencies manifest (my.project.deps.json) was not found: package: 'Microsoft.Win32.SystemEvents', version: '4.5.0' path: 'runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll'

The Microsoft.Win32.SystemEvents.dll is present in the main wwwroot folder the application is deployed to. But the whole runtimes/win/libs/ folder I don't think exists at all.

The my.project.deps.json files has the section which looks like this:

"Microsoft.Win32.SystemEvents/4.5.0": {
    "dependencies": {
      "Microsoft.NETCore.Platforms": "2.2.0"
    },
    "runtime": {
      "lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll": {
        "assemblyVersion": "4.0.0.0",
        "fileVersion": "4.6.26515.6"
      }
    },
    "runtimeTargets": {
      "runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll": {
        "rid": "win",
        "assetType": "runtime",
        "assemblyVersion": "4.0.0.0",
        "fileVersion": "4.6.26515.6"
      }
    }
  }

If I delete the whole "runtimeTargets" section, then the application works! (Well, I have to do the same for a few more dll's too: System.Drawing.Common and System.Security.Cryptography.Pkcs)

But the file gets regenerated fully whenever it is published and released - so it is not a viable solution. I also don't know what that section of the file does. It might be important to leave it in. Though it all works so it can't be that vital...

It is built and published through TeamCity - I'm not an expert on the process but I think the command being run amounts to this:

dotnet publish my.proj.csproj --configuration RELEASE --no-restore --no-build

Other things tried: < PublishWithAspNetCoreTargetManifest>false< / PublishWithAspNetCoreTargetManifest> had no effect

Anyone have any ideas?

like image 517
jb. Avatar asked May 28 '19 13:05

jb.


2 Answers

I've had same issue. After the build I copied all files to the "production" directory by DOS command copy so then the files from "runtimes" subfolder were missing. Copying all files including all subdirectories (by using xcopy) fixed the issue.

like image 178
user461128 Avatar answered Sep 27 '22 17:09

user461128


As it turns out, it was my fault :(

Team City was created a NuGet package from the published output. But the /runtimes folder was not included in the package so was never released as part of the site.

I edited the nuspec file to include it /runtimes and all works OK.

like image 34
jb. Avatar answered Sep 27 '22 17:09

jb.