Repository.Clone() not working within a Azure Function (Unable to load DLL 'git2-6311e88')
See original GitHub issueI’m trying to clone repositories in an Azure Function to determine if repositories are up and cloneable.
The following code does work in a Console App (.NET Core) project but not in an Azure function project
var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("D"));
Directory.CreateDirectory(tempPath);
var cloneDirectory = Path.Combine(tempPath, "clone");
var repositoryLocation = @"https://github.com/anthonyhuebers/GitClone.git";
var cloneResult = Repository.Clone(repositoryLocation, cloneDirectory, new CloneOptions());
In an Azure function project i get the following exception message:
The type initializer for ‘LibGit2Sharp.Core.NativeMethods’ threw an exception.
With inner exception:
Unable to load DLL ‘git2-6311e88’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Any idea why it’s not working? You can reproduce the problem by checking my git repository: https://github.com/anthonyhuebers/GitClone. I’m using LibGit2Sharp 0.25.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Azure functions: Unable to load DLL 'sni.dll' or one of its ...
It looks like something is wrong with the connection string. Please check that you are you using something similar to this:
Read more >Git clone or Git push fails to an Azure DevOps repository
This article discusses problems that might occur when you try to perform Git clone or Git push function to an Azure DevOps repository....
Read more >Azure Function Could not load file or assembly ...
I implemented an application "Azure Functions" that makes use of "Microsoft.IdentityModel.Protocols.OpenIdConnect" to authenticate the session of a user, ...
Read more >Authenticating Azure AD Function fails with "Could not load ...
After adding the file, right-click on it in the Solution Explorer and choose "Properties." In the properties window, set "Copy to Output ...
Read more >Clone an existing Git repo - Azure DevOps
In the Clone a repository window, select Azure DevOps under Browse a repository to open the Connect to a Project window.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
(Oops it was already closed. In that case I’m reopening it accidentally so that I can dramatically close it again.)
This morning I solved the problem. I used an Azure Function v1 (.NET Framework instead of .NET Standard) with the LibGit2Sharp 0.21.0.176. When you include the native binary in the release it is working!