最近开始使用 Xamarin 和 MvvmCross。忙着构建我的第一个项目。创建了我的 .Core 项目和 ViewModel,在 Visual Studio 中安装了 Nuget 包。创建了我的 .Droid 项目,安装了 Nuget 包。创建了我的第一个视图,现在尝试运行该应用程序。但是,我得到以下异常:
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'Cirrious.MvvmCross.Binding.Droid'.
Full stacktrace:
W/ ( 1438): Missing method .ctor in assembly /data/data/XamTest.Droid/files/.__override__/Cirrious.MvvmCross.Droid.dll, type System.Runtime.CompilerServices.ExtensionAttribute
W/ ( 1438): Can't find custom attr constructor image: /data/data/XamTest.Droid/files/.__override__/Cirrious.MvvmCross.Droid.dll mtoken: 0x0a000012
Unhandled Exception:
System.TypeLoadException:
E/mono ( 1438):
E/mono ( 1438): Unhandled Exception:
E/mono ( 1438): System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'Cirrious.MvvmCross.Droid'.
E/mono ( 1438): at XamTest.Droid.SplashScreen..ctor () [0x00000] in c:\Dev\XamTest\XamTest.Droid\SplashScreen.cs:16
E/mono ( 1438): at (wrapper dynamic-method) object.38e61b4f-1913-46a5-ba4a-75980457a823 (intptr,object[]) <IL 0x00018, 0x00053>
E/mono ( 1438): at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) [0x0006a] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:141
E/mono ( 1438): at (wrapper native-to-managed) Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <IL 0x0001e, 0x000a3>
E/mono ( 1438):
I/mono ( 1438): [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'Cirrious.MvvmCross.Droid'.
I/mono ( 1438): at XamTest.Droid.SplashScreen..ctor () [0x00000] in c:\Dev\XamTest\XamTest.Droid\SplashScreen.cs:16
I/mono ( 1438): at (wrapper dynamic-method) object.38e61b4f-1913-46a5-ba4a-75980457a823 (intptr,object[]) <IL 0x00018, 0x00053>
I/mono ( 1438): at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) [0x0006a] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:141
I/mono ( 1438): at (wrapper native-to-managed) Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <IL 0x0001e, 0x000a3>
I/mono ( 1438):
有任何想法吗?
我需要提到的是,当我在 Xamarin.Studio 中打开我的解决方案时,对 Core 库的引用显示为错误。
(- 不兼容的目标框架(.Net Portable Subset(.Net for Windows Store、.Net Framework 4.5、Silverlight 4、Windows Phone 7.5)。)。
不过,这可能只是另一个问题,与异常无关。