在应用程序依赖项清单中指定的程序集

An assembly specified in the application dependencies manifest

我在 mac 上写了一个 .net 核心控制台应用程序,它工作正常。然后我使用

构建了 ubuntu

dotnet build --runtime ubuntu.16.04-x64

结果是:

MyAppName.Server                MyAppName.Server.runtimeconfig.dev.json
MyAppName.Server.deps.json      MyAppName.Server.runtimeconfig.json
MyAppName.Server.dll            libhostfxr.so
MyAppName.Server.pdb            libhostpolicy.so

我将这些文件复制到我的 linux 服务器上并 运行 以下命令

dotnet MyAppName.Server.dll

现在我得到了

Error:
  An assembly specified in the application dependencies manifest (MyAppName.Server.deps.json) was not found:
    package: 'Ether.Network', version: '2.0.1'
    path: 'lib/netstandard1.3/Ether.Network.dll'

Ether.Network 是我唯一使用的软件包。

来自dotnet build's documentation

If the project has third-party dependencies, such as libraries from NuGet, they're resolved from the NuGet cache and aren't available with the project's built output. With that in mind, the product of dotnet build isn't ready to be transferred to another machine to run.

您需要 dotnet publish

The dotnet publish command's output is ready for deployment to a hosting system (for example, a server, PC, Mac, laptop) for execution and is the only officially supported way to prepare the application for deployment.