Cake.git addin выдает исключение в windows 10 - PullRequest
0 голосов
/ 09 ноября 2018

ITNOA

Привет

У меня есть чистый стандартный проект, и я хочу создать скрипт сборки с cake для этого проекта, я загружаю build.ps1 из ресурса торта и перемещаю его в каталог Build, затем создаю сборку. файл торта, как показано ниже

#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);
});

После того, как я запустил его по ./build.ps1 -script build.cake --currentBranch=develop --nugetApiKey=g234234 --coverallsToken=234234 --verbosity=Diagnostic, я вижу что-то вроде логов ниже

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 ---

Мой вопрос: зачем выбрасывать какое-то исключение? и как я могу решить это?

С наилучшими пожеланиями

1 Ответ

0 голосов
/ 09 ноября 2018

Это связано с нестандартной проблемой .NET Framework, необходима новая версия libgit2sharp. У нас есть предварительная версия, которую мы тестируем, предыдущая версия Cake.Git может работать.

...