本文介绍了无法在Ubuntu上的Mono上运行LibGit2Sharp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具有一个非常简单的单行控制台应用程序(使用monodevelop)

have a very simple one line console app (using monodevelop)

但是低于错误.

System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-e0902fb

System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-e0902fb

我的应用程序引用了两个nuget程序包

my app has reference two nuget package

  • LibGit2Sharp 0.21.0.176
  • LibGit2Sharp.NativeBinaries 1.0.119

LibGit2Sharp.Repository.Init("foler path");

LibGit2Sharp.Repository.Init("foler path");

推荐答案

libGit2Sharp 0.21.0.176 nuget确实依赖于特定的本机库,并且它需要'version/sha'e0902fb,并且不包含在或1.0.106本机nuget. (我总是从源代码构建这些软件包.)

libGit2Sharp 0.21.0.176 nuget does have dependency on a specific native library and it requires 'version/sha' e0902fb and that is not included in the 1.0.119 or 1.0.106 native nugets. (I always build these packages from source.)

LibGit2Sharp 0.22.0-pre20151023210959的预发布nuget确实包含本机nuget依赖项,并提取了可协同工作的LibGit2Sharp.NativeBinaries的1.0.6版本.

The pre-release nuget for LibGit2Sharp 0.22.0-pre20151023210959 does include a native nuget dependency and pulls 1.0.6 version of the LibGit2Sharp.NativeBinaries which work together.

使用LibGit2Sharp的预发行版本,它将引入LibGit2Sharp.NativeBinaries的1.0.6版本,该版本提供可一起使用的正确的64位共享库(libgit2-6aa06b6.so):

Either use the pre-release version of LibGit2Sharp and it will pull in the 1.0.6 version of LibGit2Sharp.NativeBinaries which provides the correct 64-bit shared library (libgit2-6aa06b6.so) that work together:

<?xml version="1.0" encoding="utf-8"?>
<packages>## Heading ##
  <package id="LibGit2Sharp" version="0.22.0-pre20151023210959" targetFramework="net45" />
  <package id="LibGit2Sharp.NativeBinaries" version="1.0.106" targetFramework="net45" />
</packages>

或:

使用LibGit2Sharp的发行版(0.21.0.176),并查看是否有基于64位基于Linux的libgit2-e0902fb.so的本机Nuget(?).

Or:

Use the release version of LibGit2Sharp (0.21.0.176) and find if a Native Nuget is available(?) with a 64-bit linux-based libgit2-e0902fb.so.

使用LibGit2Sharp的发行版(0.21.0.176)并从源代码构建本机lib.

Use the release version of LibGit2Sharp (0.21.0.176) and build the native lib from source.

这篇关于无法在Ubuntu上的Mono上运行LibGit2Sharp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-23 02:46