libgit2 / libgit2/libgit2sharp
Error loading DLL git2-3f4182d on Windows (module not found)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
I'm developing a Visual Studio 2022 extension that uses LibGit2Sharp to retrieve Git repository information (such as the current branch name) and to manage open documents based on the active branch. However, when running my extension on Windows, I encounter the following error:
Unable to load DLL 'git2-3f4182d': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I noticed that the LibGit2Sharp.dll.config file only contains dllmap entries for Linux and macOS, with no mapping for Windows. Despite installing the LibGit2Sharp.NativeBinaries package and verifying that the project’s platform configuration (x86 vs x64) matches the deployed binaries, the error persists.
I'm running on .net 4.7.2. The code is pretty simple since it's an R&D POC.
string testDir = "";
try
{
using (var repo = new Repository(_repoPath))
{
testDir = repo.Head?.FriendlyName;
}
}
_repoPath is not empty, and it exists as the current Git repository. (with an .git folder)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Repository call in the Visual Studio 2022 extension on .NET 4.7.2, then inspect LibGit2Sharp.dll.config and the installed LibGit2Sharp.NativeBinaries deployment. Check how the Windows native DLL is located and whether the deployed architecture matches the extension; done means the repository opens and repo.Head.FriendlyName can be read without the DLL-load error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100