I installed LibGit2Sharp and LibGit2Sharp.NativeBinaries with paket (first last stable version, then prerelease) and I am trying to use it in an F# script, but I keep getting this error:
Script1.fsx(3,1): error FS0229: Error opening binary file '../packages\LibGit2Sharp.NativeBinaries\runtimes\win7-x64\native\git2-381caf5.dll': ../packages\LibGit2Sharp.NativeBinaries\runtimes\win7-x64\native\git2-381caf5.dll: bad cli header, rva 0
Script1.fsx(3,1): error FS3160: Problem reading assembly '': Exception of type 'Microsoft.FSharp.Compiler.ErrorLogger+StopProcessing' was thrown.
I also tried referencing it in a C# project (VS2015 -> tried diff target frameworks: 4, 4.5.2 and 4.6.1), but I'm getting this error:
Same errors with the last stable version. Any idea what I'm doing incorrect?
You should probably reference (in VS or via #r
in FSI):
#r @"..\packages\LibGit2Sharp.0.23.0-pre20160803182831\lib\net40\LibGit2Sharp.dll"
I could do
open LibGit2Sharp
let myrepo = new Repository(@"..\Projects\StackOverflow5")
The error you got is really referring to the native libgit2 libraries and you don't need to reference them directly. However it's possible the LibGit2Sharp
cannot find them. In that case place the x64 (or x86 if you're still stuck in 32-bit) git2-381-caf5.dll
into the same folder where LibGit2Sharp.dll
lives. In this case that's the same folder I'm referencing above:
\packages\LibGit2Sharp.0.23.0-pre20160803182831\lib\net40\