Is it possible to use a Portable Class Library that references System.Net in MonoDroid?

前端 未结 1 505
孤独总比滥情好
孤独总比滥情好 2021-01-02 10:21

Following from How can I build a targetting pack for Portable Class Libraries? and the advice in http://jpobst.blogspot.com/2012/04/mono-for-android-portable-libraries-in.ht

相关标签:
1条回答
  • 2021-01-02 10:50

    A possible solution (assuming MonoDroid supports type forwarding) is to have a System.Net.dll assembly which type forwards the relevant types to System.dll.

    In the full .NET Framework, I believe those System.Net types are in System.dll, and if you look in System.Net.dll on .NET 4.0.3 or 4.5, you will see TypeForwardedToAttributes for those types, which allow those type references to System.Net.dll in a portable library to be redirected to System.dll. Jeremy Likness's blog post series on Understanding Portable Libraries goes into some detail about how this all works.

    The references in a portable library refer to the full strong name of System.Net.dll. So you couldn't produce a correctly signed assembly with those type forwards yourself, since you don't have the private key. However, MonoDroid may handle strong names or signature validation differently. So you might be able to produce a System.Net.dll with the type forwards that MonoDroid would accept, and package it with your MonoDroid application.

    0 讨论(0)
提交回复
热议问题