简体   繁体   English

初始化存储库时,LibGit2Sharp错误

[英]LibGit2Sharp errors when initializing Repository

I installed LibGit2Sharp via NuGet into a VS add-on I'm (re-)writing (Visual Studio 2015). 我通过NuGet将LibGit2Sharp安装到了我正在重新编写的VS附加组件中(Visual Studio 2015)。 The code compiles fine, but it barfs when I try to allocate the Repository: 代码可以正常编译,但是当我尝试分配存储库时,它会发出错误的声音:

using (var repo = new Repository(@"C:\Path\MyProject"))

The thing is, it used to work . 问题是,它曾经可以工作 I was testing it out, and the code ran fine. 我正在对其进行测试,并且代码运行良好。 Then-- bam --I ran it again and it stopped working. Then-- 咣当 -我再次运行它,它停止工作。 The specific error: 具体错误:

{"Unable to load DLL 'git2-785d8c4': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}

From what I understand about NuGet--which isn't a lot--it's supposed to set all that up so I don't have to worry about it. 根据我对NuGet的了解-并不多-应该将所有内容设置好,因此我不必担心。 So I uninstalled it and re-installed it. 因此,我将其卸载并重新安装。

The weird thing about LibGit2Sharp is the old version shows up first (v0.22.0) and "version 1" shows up second (v1.0.160). 关于LibGit2Sharp的怪异之处是版本首先显示(v0.22.0),而“版本1”则显示第二(v1.0.160)。 I installed 0.22.0 the first time, so I tried the second one (v1.0.160) the next time. 我第一次安装了0.22.0,因此下次尝试了第二个(v1.0.160)。 But v1.0.160 didn't work at all (none of the code compiled, errors galore). 但是v1.0.160根本不起作用(没有编译的代码,错误泛滥)。 So I uninstalled v1.0.160 and installed v0.22.0 again. 因此,我卸载了v1.0.160,然后再次安装了v0.22.0。 Now it all compiles again, but I get the error above. 现在,它们全部重新编译了,但是出现了以上错误。

Does anyone know what's going on? 有人知道发生了什么吗?

Is it possible that the .NET framework version your project targets has changed? 您的项目目标的.NET Framework版本是否可能已更改? Are you able to target .NET framework version 4.5 (rather than 4.51 or any other higher version, such as 4.6) and try again? 您是否可以定位.NET Framework 4.5版(而不是4.51或任何其他更高版本,例如4.6),然后重试?

For others who might come into this thread in the future: 对于将来可能会加入这个话题的其他人:

Put 'git2-785d8c4.dll' in the same directory where your output exe is, then it will work. 将“ git2-785d8c4.dll”放在输出exe文件所在的目录中,然后它将起作用。

you can find it in ..\\LibGit2Sharp\\bin\\Debug(Release)\\lib\\win32\\x86 您可以在.. \\ LibGit2Sharp \\ bin \\ Debug(Release)\\ lib \\ win32 \\ x86中找到它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM