适用于 android 的 Mono 存在的 dll(.NET 4 框架)问题 [英] Prexisiting dlls (.NET 4 framework) issue with mono for android

查看:23
本文介绍了适用于 android 的 Mono 存在的 dll(.NET 4 框架)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 讨论如何跨项目链接文件.

也就是说,在这种情况下,您很幸运,因为其他人已经为您完成了最后一部分!查看 Json.NET 的这个分支,它提供了 MonoTouch 和 Mono for Android 版本.

I am creating a fresh Mono for android application using http://xamarin.com/monoforandroid

I selected Mono for Android Application using Visual C# option.

My Android target version is :

I went to references of the project and tried adding my pre existing dlls (made in .NET 4 Framework) and I got this error:

The strange stuff is there is no option to change the .NET Framework from project properties. Can you tell me what I am missing?

解决方案

The problem here is that you're trying to reference a .NET 4 DLL from a project that isn't .NET 4. Mono for Android uses its own profile for .NET, which is very similar to that of Silverlight (but not exactly the same). While it's possible that adding a DLL compiled for a different profile will work, it's very risky as you will probably run into problems at runtime where your app will crash, due to something being missing from the Mono for Android profile.

The best answer right now is to create a Mono for Android class library, link in the appropriate files from the library you want to use, and reference that. This will give you compile-time checking that you're not using anything unsupported by the Mono for Android profile, and help keep you more sane in the long run. I have an old blog post up here that talks about how to link files across projects.

That said, in this case you're in luck because someone else has already done that last part for you! Check out this fork of Json.NET which provides versions for MonoTouch and Mono for Android.

这篇关于适用于 android 的 Mono 存在的 dll(.NET 4 框架)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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