码迷,mamicode.com
首页 > Web开发 > 详细

LibGit2Sharp在 Asp.Net Core 3.1 docker 镜像中中无法使用的问题

时间:2020-02-13 09:17:16      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:libs   png   常识   image   exception   com   net   img   图片   

The type initializer for ‘LibGit2Sharp.Core.NativeMethods‘ threw an exception. Unable to load shared library ‘git2-106a5f2‘ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-106a5f2: cannot open shared object file: No such file or directory

搜索了很多, 看起来全地球大家都遇到了, 然后大家都解决了, 然后就我没解决, 

比如:加入   <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

或者加入

<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; </IncludeAssets>

 

把 linux-x64 下的  libgit2-106a5f2.so 拷贝到 程序目录  lib目录等, 都没有用。  

 

常识了各种方法, 问题依旧, 

折磨了一个小时后, 突然想到一个命令, ldd  , 于是在容器中执行了一下 ldd  libgit2-106a5f2.so 

技术图片

 

 发现俩not  found , 看起来库不对劲。,最后查看容器的对应库版本是 1.1.0 ,查看了 libgit2sharp.nativebinaries\2.0.306\runtimes\ 下面  所有libgit2 的库 ldd 信息, 发现debian 9 是正确符合这个版本,

最后发现是由于项目的  RuntimeIdentifier 不设置默认是linux-64 ,然后项目加入  <RuntimeIdentifier>debian.9-x64</RuntimeIdentifier> 后, "libgit2sharp.nativebinaries\2.0.306\runtimes\debian.9-x64\native\libgit2-106a5f2.so" 文件使用的是 libssl.so.1.1.1 的版本   然后程序镜像重新打包重新运行, 一切OK . 

 

LibGit2Sharp在 Asp.Net Core 3.1 docker 镜像中中无法使用的问题

标签:libs   png   常识   image   exception   com   net   img   图片   

原文地址:https://www.cnblogs.com/MysticBoy/p/12302094.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!