Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add support for .NET Standard 2.0 #7
This is the same as #6 except it is based off the correct branch
This adds support for .NET Standard 2.0 / .NET Core 2.2. I have already published the updated version to NuGet: https://www.nuget.org/packages/gpgme-sharp/2.0.0
The trickiest part of this was the handling of the library file name. The file name differs on Windows (
However, this same functionality is not available in .NET Core. Work is currently underway to have some sort of native library loader functionality that would support this (see dotnet/corefx#32015), but as of now, it's not available.
This means I had to hack around it. My initial approach was going to be to have two classes (one for Windows, one for Linux) that implement a common interface:
Because of this, my approach ended up being quite hacky: I have one class with the Linux methods, one class with the Windows methods, and a wrapper class that has properties for each of them (see
There was another issue: I wanted to avoid copying-and-pasting the P/Invoke code, however .NET doesn't let you have the same file twice in the same assembly, with two different sets of preprocessor values. So, the Windows and Linux classes needed to be in two separate assemblies.
I updated the build to use ILRepack to merge all the assemblies together, so users shouldn't actually notice any of this hackiness. Ideally this will all be cleaned up once dotnet/corefx#32015 is completed.