ITNOA
Hi,
I have a net standard project, and i want to create build script with cake for this project, I download build.ps1 from resource of cake and move it to Build directory, then create a build.cake file like below
#addin nuget:?package=Nuget.Core
#addin nuget:?package=Cake.Git&version=0.19.0
//#addin "nuget:?package=Cake.Coveralls&version=0.9.0"
using NuGet;
var target = Argument("target", "Default");
var artifactsDir = "./artifacts/";
var solutionPath = "../BSN.Commons.sln";
var project = "../Source/BSN.Commons.csproj";
var testFolder = "../Test/BSN.Commons.Tests/";
var testProject = testFolder + "BSN.Commons.Tests.csproj";
var coverageResultsFileName = "coverage.xml";
var currentBranch = Argument<string>("currentBranch", GitBranchCurrent("./").FriendlyName);
Task("Restore")
.Does(() => {
DotNetCoreRestore(solutionPath);
});
After i run it by ./build.ps1 -script build.cake --currentBranch=develop --nugetApiKey=g234234 --coverallsToken=234234 --verbosity=Diagnostic
, I see something like below logs
Running build script...
Module directory does not exist.
NuGet.config not found.
Analyzing build script...
Analyzing D:/Users/sooro/Source/Repos/soroshsabz/Commons/Build/build.cake...
Processing build script...
Installing addins...
CACHE https://api.nuget.org/v3/registration3-gz-semver2/nuget.core/index.json
Found package 'Nuget.Core 2.14.0' in 'D:/Users/sooro/Source/Repos/soroshsabz/Commons/Build/tools/Addins'.
Package NuGet.Core.2.14.0 has already been installed.
Successfully installed 'Nuget.Core 2.14.0' to D:/Users/sooro/Source/Repos/soroshsabz/Commons/Build/tools/Addins
Executing nuget actions took 37.63 ms
The addin Nuget.Core will reference NuGet.Core.dll.
Found package 'Cake.Git 0.19.0' in 'D:/Users/sooro/Source/Repos/soroshsabz/Commons/Build/tools/Addins'.
Package Cake.Git.0.19.0 has already been installed.
Successfully installed 'Cake.Git 0.19.0' to D:/Users/sooro/Source/Repos/soroshsabz/Commons/Build/tools/Addins
Executing nuget actions took 4.37 ms
The addin Cake.Git will reference LibGit2Sharp.dll.
The addin Cake.Git will reference Cake.Git.dll.
Verifying assembly 'NuGet.Core, Version=2.14.0.832, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Verifying assembly 'LibGit2Sharp, Version=0.25.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333'.
Verifying assembly 'Cake.Git, Version=0.19.0.0, Culture=neutral, PublicKeyToken=null'.
Compiling build script...
Error: System.AggregateException: One or more errors occurred. ---> System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-6311e88': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)
at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary()
at LibGit2Sharp.Core.NativeMethods..cctor()
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.NativeMethods.git_repository_open(git_repository*& repository, FilePath path)
at LibGit2Sharp.Core.Proxy.git_repository_open(String path)
at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)
at Cake.Git.Extensions.RepositoryExtensions.UseRepository[TResult](ICakeContext context, DirectoryPath repositoryPath, Func`2 repositoryFunc)
at Cake.Git.GitAliases.GitBranchCurrent(ICakeContext context, DirectoryPath repositoryDirectoryPath)
at Submission#0.GitBranchCurrent(DirectoryPath repositoryDirectoryPath)
at Submission#0.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
My question is, why throw some exception? and how can i resolved it?
Best regards
This is due a netstandard on .NET Framework issue, a new version of libgit2sharp is needed, We've got a pre-release version we're testing, previous version of Cake.Git might work.
User contributions licensed under CC BY-SA 3.0