cake-contrib / Cake_Git

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp
https://cakebuild.net/extensions/cake-git
Other
39 stars 63 forks source link

Put `git2` dll in `native` folder #189

Closed aateeque closed 6 months ago

aateeque commented 6 months ago

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

nils-a commented 6 months ago

Are you using Cake.Frosting? I think this issue is a duplicate of https://github.com/cake-contrib/Cake_Git/issues/137, right?

aateeque commented 6 months ago

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