libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

Error loading DLL git2-3f4182d on Windows (module not found)

Open donk7413 opened this issue 10 months ago • 4 comments

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)

donk7413 avatar Feb 12 '25 10:02 donk7413

Having the same problem any solutions?

cbarkinozer-softtech avatar Mar 21 '25 11:03 cbarkinozer-softtech

Hey @donk7413 , I would like to inform you that it got solved when we downloaded that dll and put it under the "C:\Windows\System32" folder.

cbarkinozer-softtech avatar Mar 28 '25 14:03 cbarkinozer-softtech

@cbarkinozer-softtech thanks for feedback, I will check it :)

donk7413 avatar Mar 28 '25 14:03 donk7413

I'm having this issue too. My application needs to run on multiple platforms so copying the dll is not a solution unless I package it and add platform specific code, is that the recommended approach and is there an example.

Thanks

RobSmyth avatar May 26 '25 06:05 RobSmyth