Closed Nimgoble closed 7 years ago
While waiting for this, @Nimgoble, you can use PInvoke as-is by adding an imports
property to your project.json file that targets netstandard1.1 or later:
{
"frameworks": {
"netstandard1.1": {
"imports": [
".NETPortable,Version=v4.5,Profile=Profile111"
]
}
}
}
I'm looking into this now.
As something of a prereq for this work, we need CodeGeneration.Roslyn to support netstandard. I'm working through that.
Would adding netstandard support end up supporting xamarinmac?
I guess that depends on which libraries you want to P/Invoke into. But IIRC all of the libraries in this repo have p/invokes into DLLs that only ship with Windows. So what exactly are you hoping to work on xamarinmac? There are the structs that we define, but those have very limited usefulness outside Windows. For PCLCrypto, these structs are useful because some of them define crypto key data structures which apply everywhere.
pclcrypto and pclstorage
I feel like I used this before successfully when Xamarin.Mac was just Net35. Now that it is its own project type I think it is failing.
am I incorrect that pclcrypto and pclstorage work in iOS? Shouldn't they work with Unified libraries then? Thanks for your prompt response.
PCLCrypto does work on iOS. I don't recall whether PCLStorage does.
You can make netstandard projects accept PInvoke by setting the imports property in the meantime.
I understand that, but now I need a Xamarin.Mac-specific library to be able to use PCLCrypto/PCLStorage and it has no json to modify. PCLCrypto does try to install, so it might be a profile issue where Xamarin.Mac does not support profile 158. I'll experiment.
Update. When I create a Portable Project in Xamarin Studio it is Profile 111 - which is basically netstandard11.
Update2. I am able to install PCLStorage into a new Xamarin.Mac App, but PCLCrypto fails.
Update3. I suspect if the pinvoke.NCrypt target was portable-net45+win+wpa81+uwp10+dnxcore50+MonoAndroid10+xamarinios10+MonoTouch10 it might work.
PCLCrypto starts to install, but fails at NCrypt. PCLStorage installs without complaints. Could it be that we just need to add another profile to pinvoke.NCrypt in the nuspec?
portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10
portable-net45+wp8+wpa81+win8+monoandroid+monotouch+Xamarin.iOS+Xamarin.Mac portable-net45+sl5+wp8+wpa81+win8+monoandroid+monotouch+Xamarin.iOS+Xamarin.Mac
portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10
We can keep this issue active for netstandard support, but let's keep the PCLCrypto discussion on the PCLCrypto project.
Please add support for .NETStandard. I'm trying to use PCLCrypto with a .NETStandard library and it isn't working because PInvoke.NCrypt isn't compatible with any .NETStandard version.