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