1

Our C# app currently has a native C shared library from which we call a couple of functions using the Pinvoke "DLLImport". The issue is, we haven't found a way to include the shared library with the single file publish option.

This means that we'd have to give the app executable and a platform specific library file to the users, which is not ideal.

Added context: The library was already compiled for Linux (.so), macOS (.dylib) and Windows (.dll). The Pinvoke in this case handles choosing the correct one during dev and debug, and the publish config handles choosing which one to include based on the platform target. The library was compiled as an independent shared library for all three operating systems as well, without external dependencies. Runtime version is dotnet 7.

Is it possible to include this library file together with the single file executable?

We've tried the "Include native libraries for self extract" option, but it didn't include the library with it. As soon as the app reaches a library function it can't find the dll.

KTSnowy
  • 29
  • 1
  • 6
  • @oleksii I added additional context to the question. Basically the library has already been compiled for Linux, macOS and Windows as an independent shared library, all three for x64 only. The only issue is including this library without the user having to see it, which is why we really needed to include it with the single file publish like the other dotnet libraries. – KTSnowy Dec 23 '22 at 02:03
  • 2
    https://stackoverflow.com/questions/64778283/net-5-excludes-some-libraries-from-single-file-publication – Hans Passant Dec 23 '22 at 02:34

0 Answers0