Open vpaulino opened 6 years ago
Which version of .NET is installed?
Currently libgit2sharp requires .NET 4.7.2 / .NET Core 2, there's PR fir Libgit2Sharp to support 4.6.1 and once that's published I'll release a new version of Cake.Git.
@vpaulino do you know what resolved this issue? I am seeing the same issue.
@vpaulino @RickRen7575 Did you resolve the issue or if it is resolved, possible to explain how it solved?
Cake.Git Version: 0.21.0 .NET Framework Version: 4.8
sorry for my disapearing on this. From what I recall on this the problem was the framework dotnet installed on the machine.. it was installed .Net 4.6, after upgrade it works. Sorry for the late answer... 2 years after.
I am having this issue on MacOS. I'm using Cake 3.0.0, Cake.Git 3.0.0, and dotnet 7.0.102
It works fine on my Windows machine, but gets the same error message as above on MacOS:
The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception
Same here, on a Mac M1 now getting this error using Cake 2.0.0, Cake.Git 2.0.0, and tried with dotnet 7.0.203 and dotnet 6.0.408.
@ehuna I managed to work around the issue by installing version 0.27.0-preview-0175
. This is a preview version, but seems to not have the issue on Mac
@CDTR-MattConroy thanks, we tried but that did not work for us. We ended up using git directly and no longer using Cake.Git.
For example instead of using GitLogTip(), we wrote our own like this -
private string GetGitHash()
{
StartProcess(
"git",
new ProcessSettings()
.WithArguments(x => x
.Append("rev-parse")
.Append("HEAD"))
.SetRedirectStandardOutput(true),
out var lines);
var githash = string.Join(Environment.NewLine, lines);
var result = githash.Trim();
Information($"From GetGitHash(): {result}");
return result;
}
Hi there
Im using package=Cake.Git on my cake script.... and it works on my machine :) but when I execute my build in my Jenkins CI it happens an error during script execution reporting an error with this log: "The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception". My Cake.Git package version is the lastest Cake.Git.0.19.0 and the agent OS is Microsoft Windows Server Version 1607 (OS Build 14393.2485).
Does anyone knows anything about this ?