问题
an specific issue has occured in my project. I've found only one library for C# supporting Android (in Xamarin): Sharp.XMPP, NuGet, but I have troubles with it. When I write some sample code in separated portable class library, I get these errors:
Error 1: '.ctor' is not supported by the language
by the line
using (XmppClient client = new XmppClient(hostname, username, password))
{
...
}
Next:
Error 2: Metadata file '...\Project.Jabber.dll' could not be found
Warnings 2-6: Reference to type 'System.Net.Security.RemoteCertificateValidationCallback' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\System.dll', but it could not be found c:\Users\Kliford\Downloads\S22.Xmpp\S22.Xmpp.dll
I am clueless. Thank you in advance.
回答1:
Sharp.Xmpp
is not compatible with PCL
since it uses the XmlElement class, which is not currently available in PCL
.
Rewriting this part is doable, but requires a significant effort.
The workaround that I use, is to develop .Net 4.5
Class libraries, which reference Sharp.XMPP
. Portability among Windows
and .Net
is achieved through Xamarin
.
Hope this helps
回答2:
This also happens when a lower library is using a different version of the .NET Framework. You try to update de library at the same version of the .NET Framework that you use and it should work.
来源:https://stackoverflow.com/questions/32396159/xamarin-forms-portable-class-library-project-with-sharp-xmpp-library