.net core 3.1 发布到Centos (linux)系统问题BadImageFormatException

.net core 3.1开发的控制台程序在win7下正常运行,直接发布后复制到linux系统中运行报如下错误:

Unhandled exception. System.BadImageFormatException: Could not load file or assembly '/root/netcoreapp3.0/ProjectFBA_WebApi.dll'. The module was expected to contain an assembly manifest

解决方法:发布时“目标运行时”选项linux-x64,需要联网使用nuget还原相关的依赖包。

发布了181 篇原创文章 · 获赞 35 · 访问量 76万+

猜你喜欢

转载自blog.csdn.net/dacong/article/details/104159163