I have a small exe I've written that uses LibGit2Sharp
and am trying to use Costura.Fody
to embed everything so I only have a single exe to distribute (actually, there are two config files as well, but that's ok).
The problem seems to be that LibGet2Sharp.dll
has a fairly firm reference to git2-1196807.dll
, and I can't seem to figure out how to embed the latter in the way the former can use. I've tried several things, but I think my best attempt is:
all of these .dll's are copied from the solution's packages
folder and set to Build Action = Embedded Resource
and Copy to Output Directory = Do Not Copy
.
The LibGit2Sharp reference is set to Copy Local = false
, and I have tried the simple route in FodyWeavers.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<Costura>
</Costura>
</Weavers>
and a more complex is:
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<Costura>
<Unmanaged64Assemblies>
Costura64\LibGit2Sharp
Costura64\git2-1196807
</Unmanaged64Assemblies>
<Unmanaged32Assemblies>
Costura32\LibGit2Sharp
Costura32\git2-1196807
</Unmanaged32Assemblies>
</Costura>
</Weavers>
However, I always get an error, not when opening the exe, but when I click the button that first uses the git library:
...'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-1196807': The specified module could not be found. (Exception from HRESULT: 0x8007007E)...
A few things I've done have given me an error that the LibGet2Sharp
dll is inaccessible (and not the error about git2-1196807
), but I think that's just when I've crippled Fody.
I would appreciate any advice you can give; this has me baffled. If I put the git2-1196807.dll
file in the deployed location ".\lib\win32\x86" and the 64bit equivalent, then it runs fine, but that defeats the point in using costura.fody.
thoughts?