Closed
Description
So, I'm using GitVersionTask in my Docker build (using the officical microsoft/dotnet:2.1-sdk image). The issue I was having is the following error:
Could not determine assembly version: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'git2-15e1193' or one of its dependencies.
How I fixed it, is by install the library system wide and symlinking the location it's searching (used the LD_DEBUG env var to check what it was doing). In my Dockerfile I now have:
FROM microsoft/dotnet:2.1-sdk as builder
# Fix GitVersionTask build issue
RUN apt-get update && \
apt-get install -y libgit2-dev && \
ln -s /usr/lib/x86_64-linux-gnu/libgit2.so /lib/x86_64-linux-gnu/libgit2-15e1193.so
.... other build steps
I created the issue just to let you know. The current version (15e1193) is hardcoded above, so it might change depending on the LibGit2Sharp.Core.NativeMethods library version is used.