不能运行MVVMcros Xamarin.Forms项目

问题描述 投票:1回答:1

我想配置MVVMCrosswith Xamarin.Forms。所以我创建XF项目,增加了对的ViewModels antoher PCL项目。接下来,我需要instaling MVVMCross nugets includng Mvvmcross.StarterPack,MVVMCross.Forms和MVVMCross.Presentation。然后,我在项目从汽车创建垃圾ETS清洗。为了这一刻一切建筑。但是,当我在XF MainPage.xaml中ContentPage建设时间更改为MvxContentPage有以下错误:

    The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'StormFinder, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'StormFinder.dll'
   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
   at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
   at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() StormFinder.Android     

StormFinder是我XF UI项目。我用尽了一切办法,包括清洗,重装XF,MVVMCross甚至启动新的项目。

我能做什么? 编辑:项目在那里可以找到:https://github.com/straiser/StormFinder

EDIT2:这是在XAML错误的命名空间。项目目前正在建设,但现在我已经得到了另一个错误:

 System.TypeLoadException: Parent class vtable failed to initialize, due to: Type MvvmCross.Forms.Presenter.Core.MvxFormsPagePresenter has invalid vtable method slot 7 with method MvvmCross.Core.Views.MvxViewPresenter:Close (MvvmCross.Core.ViewModels.IMvxViewModel) assembly:/storage/emulated/0/Android/data/StormFinder.Android/files/.__override__/MvvmCross.Forms.Presenter.Core.dll type:MvxFormsPagePresenter member:<none>
06-12 18:52:19.744 E/mono-rt ( 1784): [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Parent class vtable failed to initialize, due to: Type MvvmCross.Forms.Presenter.Core.MvxFormsPagePresenter has invalid vtable method slot 7 with method MvvmCross.Core.Views.MvxViewPresenter:Close (MvvmCross.Core.ViewModels.IMvxViewModel) assembly:/storage/emulated/0/Android/data/StormFinder.Android/files/.__override__/MvvmCross.Forms.Presenter.Core.dll type:MvxFormsPagePresenter member:<none>
xamarin xamarin.forms mvvmcross
1个回答
1
投票

您需要在您的MvxContentPageMainPage的命名空间。

它需要像这样:

<?xml version="1.0" encoding="utf-8" ?>
<core1:MvxContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:StormFinder"
              xmlns:core="clr-namespace:MvvmCross.Forms.Presenter.Core;assembly=MvvmCross.Forms.Presenter.Core"
              xmlns:core1="clr-namespace:MvvmCross.Forms.Core;assembly=MvvmCross.Forms"
              x:Class="StormFinder.MainPage">

    <Label Text="{Binding Text}" 
           VerticalOptions="Center" 
           HorizontalOptions="Center" />
    <!-- core:MvxContentPage -->
</core1:MvxContentPage>
© www.soinside.com 2019 - 2024. All rights reserved.