MiKom
Publishing application with native libraries
Hey.
I'm trying to create an application that depends on some native shared libraries (written in C++). I created a
NativeLibraries
project that contains the required shared libraries as Content
elements in .csproj
:
Then my main application depends on this NativeLibraries
project. When I build it, everything is fine, the native libraries are nicely placed in runtimes/*
folder in the build directory of the main application.
Problem is that the libraries are not copied to the output directory directly for rid-specific publishing (dotnet publish -r linux-arm
) but are still present in runtimes/linux-arm/native
folder. Unlike for example SkiaSharp (that I also use). The native libraries of SkiaSharp are correctly copied directly to the publish output directory. SkiaSharp doesn't seem to be particularly clever here:
And the PackageFile
is expanded as follows:
Which is similar to my Content
element. I tried adding this Pack
as well but it didn't help.
Probably, SkiaSharp is doing something else that I don't see here. What may it be?
Microsoft docs mostly talk about packaging native libraries as Nuget packages which is not the case for me. Thanks11 replies