1

Currently, I have a Xamarin forms project for Android and iOS application. And the application works perfectly in both Android and iOS. I wanted to provide the support in Windows as well. So I followed the below link to add the UWP project to my solution.

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

After adding the new project for UWP the solution is build with UWP as startup project. But, when i try to run the application in Local Machine. I get the following error.

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)'

I tried both in VS2015 and VS2017, both provide the same error(VS2015 provides additional two errors regarding mscorlib which is not coming in VS2017).

Here is the stack trace for the error.

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

halfer
  • 19,824
  • 17
  • 99
  • 186
Vijay457
  • 324
  • 2
  • 11
  • From your exception, it looks that missing reference, you could try to delete the `obj` and `bin` folder under the project and rebuild your solution. Or you could provide a simple sample to me. – Nico Zhu Feb 07 '18 at 02:57
  • Thanks for the update. However, i have tried that as well by deleting the bin and obj folder and rebuild. It still throws same exception on the Xamarin.Forms.Init(e). I cant really expose my source for now. – Vijay457 Feb 07 '18 at 04:01
  • I have updated the stack trace for the error. If it helps. – Vijay457 Feb 07 '18 at 04:41
  • Have you tried to modify your target min version to 16299? – Nico Zhu Feb 07 '18 at 05:59
  • I believe i dont have that listed in my minimum target version. I got only 10240, 10586, 14393, 15063 in my machine. – Vijay457 Feb 07 '18 at 06:10
  • I could not reproduce your issue in my current environment, I suggest creating a blank app via the document that mentioned in your case. – Nico Zhu Feb 07 '18 at 06:17
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/164670/discussion-between-vijay457-and-nico-zhu-msft). – Vijay457 Feb 07 '18 at 06:27
  • As per @NicoZhu-MSFT suggestion updating to 16299 solved this issue. But, this enable my app to be deployed only in the mobiles which has Windows 10 Build 16299 installed. How can i provide support to the lower build versions of the windows 10 devices.? – Vijay457 Feb 26 '18 at 08:51

0 Answers0