简体   繁体   中英

Cannot load Main.axml layout Xamarin in Visual Studio 2015

I tried the older versions of Android SDK but every time when I try to open Main.axml I get this error:

System.ComponentModel.Composition.ImportCardinalityMismatchException: No exports were found that match the constraint: ContractName VisualStudioWorkspace RequiredTypeIdentity Microsoft.CodeAnalysis.Workspace at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition) at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore(Type type, Type metadataViewType, String contractName, ImportCardinality cardinality) at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValueCore[T](String contractName, ImportCardinality cardinality) at Xamarin.VisualStudio.Android.MonoAndroidDesignerInterface.GetCodeModelBridge() in C:\\data\\lanes\\3513\\00fa5cc4\\source\\xamarinvs\\src\\Core\\VisualStudio.Android\\Designer\\MonoAndroidDesignerInterface.cs:line 154 at Xamarin.AndroidDesigner.DesignerProject.get_CodeModelBridge() at Xamarin.AndroidDesigner.DesignerProject.d__175.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Xamarin.AndroidDesigner.DesignerProject.d__139.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Xamarin.AndroidDesigner.AndroidRenderSession.d__105.MoveNext()

First update all the Xamarin Forms ( not Xamarin.Android ) nugets. Then delete bin/obj directories from PCL and Android Setup Droid MIN sdk to 4.4 KitKat Make sure project name and version are set in droid. Build only PCL via right-mouse build. Build only Droid via right-mouse build.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM