costura.fody for a dll that references another dll

前端 未结 2 1043
你的背包
你的背包 2021-01-05 07:21

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 distri

相关标签:
2条回答
  • 2021-01-05 07:39

    If LibGit2Sharp is a normal AnyCPU .net reference, then simply having it as a reference in the project is enough, don't embed it in the Costura32/Costura64 directories. Those directories are for normal Win32 style dlls that are loaded thru LoadLibrary and such.

    0 讨论(0)
  • 2021-01-05 07:46

    Figured this out with some help from this question and had to add some work of my own.

    Essentially, you need to create a pair of folders in the project, called Costura32 and Costura64 and put the appropriate version of the dll in there, and set them to 'Embedded resource'. Then the weaver can include them in the exe when building the solution.

    In my case, I was using the LibGit2Sharp dll, which relies on git2-15e1193.dll, so I have this as part of my solution:

    and for each of those dll's, I have the Build Action set to Embedded Resource:

    Finally, the FodyWeavers.xml is:

    <?xml version="1.0" encoding="utf-8" ?>
    <Weavers>
      <costura IncludeDebugSymbls='false'>
        <Unmanaged32Assemblies>
          git2-15e1193
        </Unmanaged32Assemblies>
        <Unmanaged64Assemblies>
          git2-15e1193
        </Unmanaged64Assemblies>
      </costura>
    </Weavers>
    

    Make sure to leave the .dll off the dll names in the FodyWeavers.xml file.

    0 讨论(0)
提交回复
热议问题