首页 > 解决方案 > 未找到应用程序依赖项清单中指定的程序集

问题描述

所以我有一个 .NET Core 2.2 Web 应用程序。我向其中添加了 EPPlus 库,现在,当它发布到 Azure(应用服务)时,它不会启动,并且出现错误:

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

我通过在 Azure 中运行控制台和命令:“dotnet my.project.dll”来缩小范围 - 并得到了实际错误:

找不到应用程序依赖项清单 (my.project.deps.json) 中指定的程序集:包:'Microsoft.Win32.SystemEvents',版本:'4.5.0' 路径:'runtimes/win/lib/netcoreapp2.0 /Microsoft.Win32.SystemEvents.dll'

Microsoft.Win32.SystemEvents.dll 位于应用程序部署到的主 wwwroot 文件夹中。但是我认为根本不存在整个 runtimes/win/libs/ 文件夹。

my.project.deps.json 文件的部分如下所示:

"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"
      }
    }
  }

如果我删除整个“runtimeTargets”部分,那么应用程序就可以工作了!(好吧,我也必须为更多的 dll 做同样的事情:System.Drawing.Common 和 System.Security.Cryptography.Pkcs)

但是,只要文件被发布和发布,它就会完全重新生成 - 所以它不是一个可行的解决方案。我也不知道文件的那个部分是做什么的。把它留在里面可能很重要。虽然这一切都有效,所以它不可能那么重要......

它是通过 TeamCity 构建和发布的 - 我不是该过程的专家,但我认为正在运行的命令相当于:

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

其他尝试过:<PublishWithAspNetCoreTargetManifest>false</ PublishWithAspNetCoreTargetManifest>没有效果

有人有想法么?

标签: azureasp.net-core.net-coreepplus

解决方案


我有同样的问题。构建后,我通过 DOS 命令将所有文件复制到“生产”目录,copy因此“运行时”子文件夹中的文件丢失了。复制包括所有子目录的所有文件(通过使用xcopy)解决了这个问题。


推荐阅读