Xamarin UWP项目中的System.Core v4.0.0.0异常

时间:2018-02-06 10:33:10

标签: c# xamarin.forms runtime-error xamarin.uwp new-project

目前,我有一个适用于Android和iOS应用程序的Xamarin表单项目。该应用程序在Android和iOS中都运行良好。我也希望在Windows中提供支持。所以我按照以下链接将UWP项目添加到我的解决方案中。

https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/

在为UWP添加新项目之后,使用UWP作为启动项目构建解决方案。但是,当我尝试在Local Machine中运行应用程序时。我收到以下错误。

System.IO.FileLoadException: 'Could not load file or assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

我在VS2015和VS2017中都尝试了两者,两者都提供相同的错误(VS2015提供了关于mscorlib的额外两个错误,这些错误未在VS2017中出现)。

这是错误的堆栈跟踪。

  

在System.ModuleHandle.ResolveType(RuntimeModule模块,Int32 typeToken,IntPtr * typeInstArgs,Int32 typeInstCount,IntPtr * methodInstArgs,Int32 methodInstCount,ObjectHandleOnStack类型)      在System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule模块,Int32 typeToken,RuntimeTypeHandle [] typeInstantiationContext,RuntimeTypeHandle [] methodInstantiationContext)      在System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken,Type [] genericTypeArguments,Type [] genericMethodArguments)      at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord,MetadataImport scope,Assembly& lastAptcaOkAssembly,RunadataModule decoratedModule,MetadataToken decoratedToken,RuntimeType attributeFilterType,Boolean mustBeInheritable,Object [] attributes,IList derivedAttributes,RuntimeType& attributeType,IRuntimeMethodInfo& ctor,Boolean& ctorHasParameters ,布尔& isVarArg)      在System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule,Int32 decoratedMetadataToken,Int32 pcaCount,RuntimeType attributeFilterType,Boolean mustBeInheritable,IList derivedAttributes,Boolean isDecoratedTargetSecurityTransparent)      在System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly程序集,RuntimeType caType)      at System.Attribute.GetCustomAttributes(Assembly element,Type attributeType,Boolean inherit)      在Xamarin.Forms.Internals.Registrar.RegisterAll(Type [] attrTypes)      在Xamarin.Forms.Forms.Init(IActivatedEventArgs launchActivatedEventArgs,IEnumerable`1 rendererAssemblies)      在ShowCaseSample.UWP.App.OnLaunched(LaunchActivatedEventArgs e)

0 个答案:

没有答案