4

I'm trying to use libgit2sharp in a web-project. The problem is that libgit2sharp's solution is for VS2010 and I'm using VS2008. So I had to create a new solution and modify the code not to use default parameters. That wasn't a problem, except I'm getting the exception listed in the title when I try to use the compiled libgit2sharp DLL.

I've tried linking in the git2.dll, but that hasn't helped. Copying the git2.dll into the web-project hasn't helped either.

Edit: The issue was handled over at the LibGit2Sharp issue tracker: https://github.com/libgit2/libgit2sharp/issues/39

nulltoken
  • 64,429
  • 20
  • 138
  • 130
Chuck Savage
  • 11,775
  • 6
  • 49
  • 69

1 Answers1

8

Off the top of my head, I'd say that the git2.dll (compiled version of C libgit2 library) is not in your output directory (bin\[Release|Debug]).

As git2.dll is not a managed dependency, you cannot reference it from your project.

However, thanks to a prebuild event, you should be able to copy the binary to your output directory.

Another option would be to link to the dll file from within your solution and change its properties to make it 'copied if newer' (see below)

enter image description here

Should you encounter any problem, please create an issue in the bug tracker.

It will be easier to track ;-)

UPDATE:

In order for this to run, you have to make sure that after compilation, the file libgit2.dll is located in the same directory than the assembly LibGit2Sharp.dll. This way, the dynamic loading of the native library by the assembly will work as expected.

The git2.dll (compiled version of C libgit2 library) should be generated at the top level of your output directory (bin\[Release|Debug]).

More thorough information can be found in the ticket

nulltoken
  • 64,429
  • 20
  • 138
  • 130
  • Ok, I opened a ticket since that didn't help - I'd already had it linked and copied to all the bin/output folders. – Chuck Savage Jun 11 '11 at 19:21
  • @Chuck Savage did moving the git2.dll out of the Lib folder, and putting it at the top level of your project, solve your issue? – nulltoken Jun 13 '11 at 10:26
  • @nulltoken: +1 Adding as Link is a nice idea.. Was previously coding the prebuild part.. – jacob aloysious May 03 '13 at 04:15
  • @nulltoken: I see we have two binaries one under `amd64` and other under `x86`. My application is a windows 32bit app which runs on both x86 and 64bit(registry: Wow6432Node helps). Should I add the `amd64` one also to my project? – jacob aloysious May 03 '13 at 04:37
  • @jacobaloysious: If your app is 32bits only, feel free to only deploy the native 32bit dll. It can either be deployed next to the managed assembly or within a Lib/NativeBinaries/x86 directory structure where it will be loaded from. – nulltoken May 03 '13 at 07:33
  • @nulltoken: A 32bit app fails on 64bit OS if I use only 32bit.dll.. I had to add the amd64.dll to make it run.. – jacob aloysious May 04 '13 at 04:24