c# - 在应用程序依赖项 list 中指定的程序集

标签 c# ubuntu .net-core ubuntu-16.04 .net-core-2.0

我在 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.

关于c# - 在应用程序依赖项 list 中指定的程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48600575/

相关文章:

c# - 是否可以强制泛型类从两个接口(interface)之一继承类型?

c# - 如何为 IdentityServer4 Entity Framework 核心迁移指定架构?

mysql - 如何启用 MySQL 二进制日志记录?

.net - 单元测试 serilog 配置

c# - 如何使用.NET Core(FtpWebRequest)通过squid代理通过FTP获取文件?

c# - 运行 SQL 命令并返回消息

docker - 启动用户态代理 : listen tcp4 0. 0.0.0:80 时出错:绑定(bind):地址已在使用中

macos - 无法从 docker 容器访问本地网络 IP

c# - 如何在 Startup.cs ASP.NET Core 中删除 WebDav

c# - 如何使用 Xamarin for Visual Studio 在真实的 Android 设备上进行调试?