-
Notifications
You must be signed in to change notification settings - Fork 4
.NET support information
The generated .NET bindings currently targets .NET Standard 2.0. Microsoft provides a complete table of compatibility for it. The tl;dr is we support .NET Core 2.0+, .NET 5+ and .NET Framework 4.6.1+ (although 4.7.2+ is recommended).
The native libraries are located in a special directories of the NuGet package that are automatically looked at when loading a library through P/Invoke. It is vaguely described in this article.
The special directories are runtimes/<rid>/native
. The RID stands for "Runtime Identifier". The copying is done in the csproj via this line.
.NET Framework is different from everything and badly documented. I learned to hate it more every day I spent working with it.
There is no automatic loading available. Therefore, I ended up using a MSBuild script to copy the native libraries to the build directory. Two files are involed in this.
The first one, named build/net45/<foo>.targets
contains the actual script to copy the files on build. It only supports Windows, since .NET Framework only supports Windows.
The second one, named buildTransitive/net45/<foo>.targets
simply points to the first one. We need both since the first one is only executed when you depend directly on the bindings, while second one is executed for any build that depends on it transitively.
This is heavily inspired by how the gRPC lib does it. More details are available in #147.
(This information is valid as of April 2022, on oo-bindgen 0.2.0)