【问题标题】:Unable to load Json.NET dll Xamarin Studio无法加载 Json.NET dll Xamarin Studio
【发布时间】:2013-09-24 10:21:03
【问题描述】:

我有一个用于 Xamarin 的 Indie license,以便我可以使用我最精通的编程语言 C# 为 iPhone/iPad 开发应用程序。有了这个许可证,我就不能使用 Xamarin 的 Visual Studio 插件。我仍然更喜欢Visual Studio 而不是Xamarin Studio,所以我仍然在Visual Studio 上开发不需要MonoTouch 引用的任何代码,然后手动将dll 复制到Xamarin Studio

我有一个程序集 .Net framework 4.5,当我尝试调试我的应用程序时收到以下错误消息:

加载的程序集:/Users/EdGriMac/Dropbox/Quiz/Newtonsoft.Json.dll [外部的] 2013-09-23 20:30:38.021 Exam936[2228:c07] 无法加载“Newtonsoft.Json”进行注册: System.Reflection.ReflectionTypeLoadException:无法加载模块中的类。 在(包装器托管到本机)System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool) 在 System.Reflection.Assembly.GetTypes () [0x00000] 中 /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:351 在 MonoTouch.Registrar.OldDynamicRegistrar.RegisterAssembly (System.Reflection.Assembly a) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/OldDynamicRegistrar.cs:67 2013-09-23 20:30:38.023 Exam936[2228:c07] 这可能是由于模拟器保存了一个过时的组件,位置: /Users/EdGriMac/Dropbox/Quiz/Newtonsoft.Json.dll

我的尝试:

  1. 首先想到的是 NewtonSoft.Json 不能与 MonoTouch 一起使用,但我不知道如何找到。有没有办法确定是否可以使用第 3 方 dll?

  2. 我的第二个想法是NewtonSoft.Json 的较旧或较新版本可以被另一个程序集使用。然而,这不是一个大项目,我拥有的唯一使用Json 的其他程序集是RestSharp,但我不认为它使用NewtonSoft.Json。我查看了他们的 GitHub 页面的网页,但找不到参考。

  3. 我google了一下,发现this post说(有点下降)MonoTouch.Registrar.OldDynamicRegistrar.RegisterAssembly表示(引用:)I can't build the app using the build flags --registrar:olddynamic. If I remove that, it now works, I can now link and it appears to be working..这可能是Visual Studio中的一个设置,当你有一个Business license。没有这些标志我不知道如何构建。

我正在尝试做的事情可能吗?如果是,我该怎么办?

提前致谢!

【问题讨论】:

  • 获取可从 Xamarin 组件商店获得的 Json.Net 版本。它只是工作。
  • 使用 scan.xamarin.com 扫描此程序集,正如您在我的另一个问题 (stackoverflow.com/questions/18980512/…) 中所建议的那样,我发现 NewtonSoft.Json 仅 90% 兼容。我将在今天晚些时候尝试您的替代方案。

标签: xamarin.ios xamarin-studio


【解决方案1】:

来自 Xamarin 组件存储 (http://components.xamarin.com/view/json.net/) 的 Json.NET 版本运行良好。它直接从Xamarin Studio 内部安装

【讨论】:

  • 我不太明白为什么,但正如你所说,它确实有效。
  • 因为有人花时间对其进行调整,使其与 monoTouch 中可用的 .NET 配置文件兼容。
  • 从 5.1(内部版本 479)开始不再是这种情况
猜你喜欢
  • 2015-09-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-26
  • 2012-01-30
  • 1970-01-01
相关资源
最近更新 更多