使用Windows兼容包部署.NET Core应用程序

时间:2018-11-21 20:42:58

标签: deployment .net-core event-log

我正忙于将.NET Core 2.1应用程序部署到我们的测试环境中,但遇到以下错误。

<div id="dangerAlert">
  <span class="text-danger">
        This Alert is dangerous
      </span>
</div>

我们正在使用Windows Compatibility Pack访问事件日志。

我在依赖项Json文件中有以下项目:

Error:
  An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:
    package: 'System.Diagnostics.EventLog', version: '4.5.0'
    path: 'runtimes/win/lib/netcoreapp2.1/System.Diagnostics.EventLog.dll'

请告知应该如何部署这些依赖项。另外,此相对路径"System.Diagnostics.EventLog/4.5.0": { "dependencies": { "Microsoft.Win32.Registry": "4.5.0", "System.Security.Permissions": "4.5.0", "System.Security.Principal.Windows": "4.5.0", "System.Threading.AccessControl": "4.5.0" }, "runtime": { "lib/netstandard2.0/System.Diagnostics.EventLog.dll": { "assemblyVersion": "4.0.0.0", "fileVersion": "4.6.26515.6" } }, "runtimeTargets": { "runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll": { "rid": "win", "assetType": "runtime", "assemblyVersion": "4.0.0.0", "fileVersion": "4.6.26515.6" } } } 的根文件夹是什么?

1 个答案:

答案 0 :(得分:1)

我们实际上找到了针对我们场景的解决方案: -我们的情况是我们试图在测试代理上运行基于netcoreapp的测试项目 -dotnet test在项目文件上有效 -dotnet vstest有时在项目输出目录上起作用(我们不确定为什么以及在哪个设置上使用) -dotnet vstest在运行到其他目录并从CI下载时确实遇到了以上错误 -dotnet vstest确实在测试代理上碰到了AssemblyNotFoundException(对我们没有任何意义)

解决方案是将dotnet publish用于我们的测试项目,并使用“自包含”输出在测试代理上运行。 dotnet publish将所需的runtimes/win/lib/netcoreappX.X/*.dll文件复制到了发布输出目录中。