libgit2 / libgit2sharp.nativebinaries

MIT License
29 stars 63 forks source link

Can't load native binaries when targeting .NET Standard or .NET Core #101

Closed splatteredbits closed 5 years ago

splatteredbits commented 5 years ago

When I reference LibGit2Sharp in a project that targets netstandard2.0 or netcoreapp2.1, the lib directory expected by the LibGit2Sharp.dll isn't properly filled. If I target net46 it is. It looks like the NuGet package ships with a .props file that creates the lib directory but there is no equivalent file for netstandard2.0 or netcoreapp2.1.

Steps to Reproduce:

  1. Create a library that references LibGit2Sharp. Set TargetFrameworks to net46;netstandard2.0;netcoreapp2.1.
  2. Run dotnet publish --framework=net46. Note that the lib directory is correctly created.
  3. Run dotnet publish --framework=netstandard2.0 and dotnet publish --framework=netcoreapp2.1 and note that instead of a lib directory, you get a runtimes directory and all the binaries are not in places LibGit2Sharp expects.
splatteredbits commented 5 years ago

Nevermind. You can close this. I finally understood that the libraries are published to a runtimes directory for .NET Core/Standard.