linux .net core dotnet执行exe缺失libhostpolicy.so

发布时间 2024-01-07 03:13:41作者: 明月心~

linux .net core dotnet执行exe缺失libhostpolicy.so

  • 执行"zhtz.exe"程序
dotnet "zhtz.exe"
  • 错误内容
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/opt/cshop/'.
Failed to run as a self-contained app.
  - The application was run as a self-contained app because '/opt/cshop/zhtz.runtimeconfig.json' was not found.
  - If this should be a framework-dependent app, add the '/opt/cshop/zhtz.runtimeconfig.json' file and specify the appropriate framework.
  • 新增配置文件zhtz.runtimeconfig.json
vim /opt/cshop/zhtz.runtimeconfig.json
  • 文件内容如下
{
   "runtimeOptions": {
     "framework": {
       "name": "Microsoft.NETCore.App",
       "version": "8.0.0"
     },
     "additionalProbingPaths": [
       "./runtimes/"
     ]
   }
 }