Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DllNotFoundException in VSO Task #589

Closed
pascalberger opened this issue Aug 19, 2015 · 7 comments · Fixed by #590
Closed

DllNotFoundException in VSO Task #589

pascalberger opened this issue Aug 19, 2015 · 7 comments · Fixed by #590

Comments

@pascalberger
Copy link
Member

While running the VSO build task (from c5fd92a) on an agent without Git installed I get the following exception:

System.IO.FileNotFoundException: The executable file 'git' could not be found.
File name: 'git' ---> System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Run(Action`1 output, Action`1 errorOutput, TextReader input, String exe, String args, String workingDirectory, KeyValuePair`2[] environmentalVariables)
   at GitVersion.LibGitExtensions.DumpGraph(String workingDirectory, Action`1 writer, Nullable`1 maxCommits)
Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-e0902fb': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
at LibGit2Sharp.Core.NativeMethods..cctor()
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.NativeMethods.RemoveHandle()
at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()
@pascalberger
Copy link
Member Author

It seems like GitVersion still needs the Git command line tool installed on the agent, contrary to the statement of @JakeGinnivan in #562 (comment)). Corresponding code is here: https://github.com/GitTools/GitVersion/blob/master/src/GitVersionCore/LibGitExtensions.cs#L192.

Should we handle this a prerequisite of the build agent and document accordingly, or do you see a possibility to replace all calls to the Git command line tool with LibGit?

@pascalberger
Copy link
Member Author

Full log is here (note that I used the version from #588 to have the path quoted):

******************************************************************************
Starting task: GitVersion for
******************************************************************************
Executing the following commandline. (workingFolder = C:\BuildAgent\tasks\GitVersion\3.1.0)
C:\BuildAgent\tasks\GitVersion\3.1.0\GitVersion.exe "d:\work\125afab5\My Project" /output buildserver /updateAssemblyInfo true /nofetch 
Error message highlight pattern: 
Warning message highlight pattern: 
INFO [08/19/15 10:35:07:60] Working directory: d:\work\125afab5\My Project
INFO [08/19/15 10:35:07:63] Applicable build agent found: 'VsoAgent'.
INFO [08/19/15 10:35:07:63] Branch from build environment: refs/heads/develop
ERROR [08/19/15 10:35:07:71] An unexpected error occurred:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-e0902fb': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
   at LibGit2Sharp.Core.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at LibGit2Sharp.Core.NativeMethods.git_buf_free(GitBuf buf)
   at LibGit2Sharp.Core.Proxy.git_buf_free(GitBuf buf)
   at LibGit2Sharp.Core.Handles.GitBuf.Dispose()
   at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever)
   at LibGit2Sharp.Core.Proxy.git_repository_discover(FilePath start_path)
   at LibGit2Sharp.Repository.Discover(String startingPath)
   at GitVersion.GitDirFinder.TreeWalkForDotGitDir(String currentDirectory)
   at GitVersion.GitPreparer.GetDotGitDirectory()
   at GitVersion.GitPreparer.Initialise(Boolean normaliseGitDirectory, String currentBranch)
   at GitVersion.ExecuteCore.ExecuteGitVersion(IFileSystem fileSystem, String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId)
   at GitVersion.SpecifiedArgumentRunner.Run(Arguments arguments, IFileSystem fileSystem)
   at GitVersion.Program.VerifyArgumentsAndRun()
INFO [08/19/15 10:35:07:71] 
INFO [08/19/15 10:35:07:71] Here is the current git graph (please include in issue): 
INFO [08/19/15 10:35:07:71] Showing max of 100 commits
INFO [08/19/15 10:35:07:74] Could not execute 'git log' due to the following error:
System.IO.FileNotFoundException: The executable file 'git' could not be found.
File name: 'git' ---> System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Run(Action`1 output, Action`1 errorOutput, TextReader input, String exe, String args, String workingDirectory, KeyValuePair`2[] environmentalVariables)
   at GitVersion.LibGitExtensions.DumpGraph(String workingDirectory, Action`1 writer, Nullable`1 maxCommits)
INFO [08/19/15 10:35:07:60] Working directory: d:\work\125afab5\My Project
INFO [08/19/15 10:35:07:63] Applicable build agent found: 'VsoAgent'.
INFO [08/19/15 10:35:07:63] Branch from build environment: refs/heads/develop
ERROR [08/19/15 10:35:07:71] An unexpected error occurred:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-e0902fb': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
   at LibGit2Sharp.Core.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at LibGit2Sharp.Core.NativeMethods.git_buf_free(GitBuf buf)
   at LibGit2Sharp.Core.Proxy.git_buf_free(GitBuf buf)
   at LibGit2Sharp.Core.Handles.GitBuf.Dispose()
   at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever)
   at LibGit2Sharp.Core.Proxy.git_repository_discover(FilePath start_path)
   at LibGit2Sharp.Repository.Discover(String startingPath)
   at GitVersion.GitDirFinder.TreeWalkForDotGitDir(String currentDirectory)
   at GitVersion.GitPreparer.GetDotGitDirectory()
   at GitVersion.GitPreparer.Initialise(Boolean normaliseGitDirectory, String currentBranch)
   at GitVersion.ExecuteCore.ExecuteGitVersion(IFileSystem fileSystem, String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId)
   at GitVersion.SpecifiedArgumentRunner.Run(Arguments arguments, IFileSystem fileSystem)
   at GitVersion.Program.VerifyArgumentsAndRun()
INFO [08/19/15 10:35:07:71] 
INFO [08/19/15 10:35:07:71] Here is the current git graph (please include in issue): 
INFO [08/19/15 10:35:07:71] Showing max of 100 commits
INFO [08/19/15 10:35:07:74] Could not execute 'git log' due to the following error:
System.IO.FileNotFoundException: The executable file 'git' could not be found.
File name: 'git' ---> System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Start(ProcessStartInfo startInfo)
   at GitVersion.Helpers.ProcessHelper.Run(Action`1 output, Action`1 errorOutput, TextReader input, String exe, String args, String workingDirectory, KeyValuePair`2[] environmentalVariables)
   at GitVersion.LibGitExtensions.DumpGraph(String workingDirectory, Action`1 writer, Nullable`1 maxCommits)
Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-e0902fb': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
at LibGit2Sharp.Core.NativeMethods..cctor()
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.NativeMethods.RemoveHandle()
at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()
******************************************************************************
Finishing task: GitVersion
******************************************************************************

@johnkattenhorn
Copy link
Contributor

@pascalberger, strange, I pulled from Master and deployed the Custom VSO Task and it worked for me, I saw a separate directory with the external components in it.

@pascalberger
Copy link
Member Author

@johnkattenhorn Do you have Git command line tools installed on your build agent?

@SimonCropp
Copy link
Contributor

the task zip is missing some files let me look into it

@johnkattenhorn
Copy link
Contributor

Not that I know of, I didn't add it deliberately. @SimonCropp - Yep they were missing when I checked last night so I built myself from Master.

@SimonCropp
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants