Hi,
is there some documentation already about it ? I looked for it without luck.
Maybe where i can understand also the packaging story and the resolution, publishing etc. to diagnose problems.
Thanks
Hello, there is no .NETCore or .NET Standard specific documentation about it because there is nothing special compared to Desktop. If you have a managed .NETStandard library, you should be able to just add DllImports and PInvoke into them as you would in traditional .NET Framework. That said, you should take into consideration that if you want your .NETStandard library to run everywhere then this native dependency will have to be available on all platforms, or else there might be some places where your PInvoke fails. That is why in general, the advise is to try to go managed code (and .NETStandard based for that matter) when possible.
Thanks @joperezr
i'll check into nuget, i'm trying to discover how native dlls get copied to output folder in the new project system. Up to now as i understand there is a convention that if in a nuget package you have a runtimes folder like runtimes\linux-arm\native\ what's inside is copied to output folder during publish. I do not know how it works running in debug.
Correct, if you are writing both the netstandard library, and the native code, then you would want your package to look something like:
\lib
\netstandard2.0
\YourManagedLibrary.dll
\runtimes
\win-x64
\native
\YourNativeLibForWinX64.dll
\win-x86
\native
\YourNativeLibForWinX86.dll
\linux-arm
\native
\YourNativeLibForLinuxArm.dll
... (and the rest of the RIDs you want to support)
For more info, you can check https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package
Awesome thanks !
I was able to make it work via nuget and the new project system, but not linking the project directly.
Most helpful comment
Awesome thanks !
I was able to make it work via nuget and the new project system, but not linking the project directly.