在 MonoDroid 上重用 MonoTouch 库 [英] Reuse MonoTouch library on MonoDroid

查看:30
本文介绍了在 MonoDroid 上重用 MonoTouch 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用 MonoTouch 轻松地将现有的 .NET 桌面应用程序移植到 iPhone.作为该过程的一部分,我必须为我的所有项目创建新的 iOS版本" - MonoTouch 类库项目链接来自我现有项目的文件.这很好用.

I was able to easily port an existing .NET desktop app to iPhone using MonoTouch. As part of that process, I had to create new iOS 'versions' of all my projects - MonoTouch class library projects linking the files from my existing projects. This works great.

现在我想做一个 MonoDroid 端口.我可以只引用我的 iOS 库吗?或者它们需要是 MonoDroid 类库吗?

Now I want to do a MonoDroid port. Can I just reference my iOS libraries? Or do they need to be MonoDroid class libraries?

根据文档,MonoTouch 和 MonoDroid 配置文件似乎相同:

The MonoTouch and MonoDroid profiles seem to be the same, based on the documentation:

http://monotouch.net/Documentation/Assemblieshttp://mono-android.net/Documentation/Assemblies

有人在 MonoDroid 中使用过 MonoTouch 类库吗?

Has anyone used a MonoTouch class library with MonoDroid?

提前致谢

推荐答案

如果您使用的是 MonoTouch 4.0,程序集不引用 monotouch.dll (直接或间接),那么您只需要从 Mono for Android 项目中引用程序集.

If you're using MonoTouch 4.0, and the assembly doesn't reference monotouch.dll (directly or indirectly), then you just need to reference the assembly from your Mono for Android project.

请注意,此时您只能引用程序集(.dll),而不能引用项目(.csproj).

Note that at this time you can only reference the assembly (.dll) and not the the Project (.csproj).

反之亦然(引用 Mono for Android 程序集并在您的 MonoTouch 项目中使用,只要 Mono for Android 程序集不引用 Mono.Android.dll).

The reverse should also be true (reference a Mono for Android assembly and use in your MonoTouch project, as long as the Mono for Android assembly doesn't reference Mono.Android.dll).

如果出现问题,请提交错误:我们完全希望 MonoTouch 和 Mono for Android API 相互兼容.(只要有可能,即,除非/直到 Apple 取消 JIT 限制,否则两个平台都不会支持诸如 System.Reflection.Emit 之类的东西.)

If this breaks, please file a bug: we fully intend for the MonoTouch and Mono for Android APIs to be compatible with each other. (Whenever possible, that is; things such as System.Reflection.Emit will never be supported on both platforms unless/until Apple removes the JIT restriction.)

这篇关于在 MonoDroid 上重用 MonoTouch 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆