Problems loading git2.dll?

I am trying to use the libgit2sharp library. My only code

Repository repository = new Repository(@"C:\Path\To\Repo");

and when I run it, I get the error "Unable to load the git2 DLL: the specified module was not found. So, I manually went and grabbed git2.dll from libgit2sharp and moved it to the directory. When starting the same program after Another error occurs: an attempt was made to load a program with the wrong format.

While researching this, I found this post , and a solution that seemed to work for the poster didn't work for me. This post was also made a year ago, and a fix was made for it, I used the last libgit2sharp branch (ive tried the old repositories without changes)

Any ideas?

+5
source share
1 answer

The recommended option is to install the latest LibGit2Sharp NuGet package , which will take care of installing everything in the correct location.

However, if you prefer to handle it manually, GitHub repository includes x86and amd64version git2.dll. Performing a branch check masteror vNextshould get them.

Remember that each version of LibGit2Sharp works against a specific version of the libgit2 binary. Each LibGit2Sharp branch contains a submodule libgit2, which indicates the completion of the libgit2 commit.

submodule

In order for it to work perfectly, the LibGit2Sharp assembly expects the binary to git2.dllbe placed in a specific tree structure.

LibGit2Sharp.dll
|__NativeBinaries
   |__x86
   |  |_git2.dll
   |
   |__amd64
      |_git2.dll
+2

All Articles