cake-contrib / Cake_Git

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp

Home Page:https://cakebuild.net/extensions/cake-git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Put `git2` dll in `native` folder

aateeque opened this issue · comments

Hi
Because the git2 dll is a native dll and it is not in the native folder in nuget, I get a warning when running dotnet build on a consuming project. The verbose details are:

1:7>C:\Program Files\dotnet\sdk\8.0.201\Microsoft.Common.CurrentVersion.targets(2389,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. PE image does not have metadata. PE image does not have metadata. [c:\dev\code\syndicate\provenance\src\Tools\Onyx\Cicd.Orchestrator\Provenance.Tools.Onyx.Cicd.Orchestrator.csproj]
                         Resolved file path is "C:\dev\etc\nuget-cache\global\cake.git\3.0.0\lib\net7.0\git2-6777db8.dll". (TaskId:79)
                         Reference found at search path location "{HintPathFromItem}". (TaskId:79)

Having looked into this issue a little bit more, it seems the native dll needs to be put inside the native folder in the nupkg; this is detailed here & here.

I have also dotPeeked into the actual dll and see that it is in fact a native assembly; so above does stand to reason; happy to help fix this if needed

image

Are you using Cake.Frosting?
I think this issue is a duplicate of #137, right?

it is thanks @nils-a - fixed with referencing LibGit2Sharp.NativeBinaries - thanks