libgit2 / libgit2/libgit2sharp

Enable static linking of libgit2 (NativeLibrary / DirectPInvoke) for NativeAOT builds

Open
#2,160 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

Overview
Publishing with dotnet publish -p:PublishAot=true (NativeAOT) currently leaves the libgit2 native DLL/so/dylib in the output folder, preventing a true single-file distribution. If LibGit2Sharp exposed NativeLibrary / DirectPInvoke metadata to let the linker embed a static libgit2, NativeAOT users could ship just one executable.

Problems

  • NativeAOT disables the single-file bundler, so IncludeNativeLibrariesForSelfExtract is ignored and the native library is always emitted next to the .exe.
  • Distributors must ship extra files, and there is no self-extract logic at runtime.

Request
Please add official support for statically linking libgit2 when LibGit2Sharp is used with NativeAOT (for example, by publishing a package that injects the required NativeLibrary metadata).

Reference

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dotnet publish -p:PublishAot=true scenario and the linked Microsoft Docs Native AOT interop reference. Determine how LibGit2Sharp can expose NativeLibrary/DirectPInvoke metadata and package it for static libgit2 linking. Done means a NativeAOT publish produces one executable without a separate libgit2 DLL, .so, or .dylib.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.