我从Nuget安装了Xamarin Forms Carousel视图
然而,我得到了两个错误:
1)无法解析程序集:“Xamarin.Forms.CarouselView,Version=0.0.0.0,Culture=neutral,PublicKeyToken=null”“
2) ResolveLibraryProjectImports任务意外失败。System.IO.FileNotFoundException:未能加载程序集'MashamApp,Version=0.0.0.0,Culture=neutral,PublicKeyToken=‘。也许它不存在于Android的Mono配置文件中?
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:control="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.CarouselView"
x:Class="MashamApp.MainPage" BackgroundColor="#ff1b74bb">
<Grid x:Name="gMain" BackgroundColor="#ffebf6ff">
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="1*"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Label x:Name="lblName" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" FontSize="Medium" TextColor="White"></Label>
</Grid>
<Grid Grid.Row="1">
<control:CarouselView ItemsSource="{Binding MyDataSource}">
<control:CarouselView.ItemTemplate>
<DataTemplate>
<Label Text="{Binding LabelText}" />
</DataTemplate>
</control:CarouselView.ItemTemplate>
</control:CarouselView>
</Grid>发布于 2017-08-10 04:41:40
我不推荐任何代码更改,因为你的代码看起来很好,但是Xamarin.Forms.CarouselView,Version=0.0.0.0,Culture=neutral,PublicKeyToken=null在我看来有点可疑。我建议您确保您的所有引用都正常工作(项目中的引用没有黄色三角形),也许可以尝试使用nu get package manager console命令重新安装所有的包
Update-Package您还可以将其限制为一个项目。
Update-Package -Project YourProjectName如果您想要将这些包重新安装到与以前安装的版本相同的版本,那么您可以使用带有更新包命令的-reinstall参数。
Update-Package -reinstall我从这个答案How do I get NuGet to install/update all the packages in the packages.config?中学到了一些。
希望这能有所帮助!如果没有,让我知道,我会删除答案(我不得不使用答案,因为我不能评论低于50代表)干杯!
发布于 2017-08-12 16:32:17
嗯,看起来他们改变了命名空间的名称和控件的名称,代码应该是这样的:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:c="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
x:Class="MashamApp.MainPage" BackgroundColor="#ff1b74bb">
<Grid x:Name="gMain" BackgroundColor="#ffebf6ff">
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="1*"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Label x:Name="lblName" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" FontSize="Medium" TextColor="White"></Label>
</Grid>
<Grid Grid.Row="1">
<c:CarouselViewControl x:Name="CaruselViewCon" ItemsSource="{Binding MyDataSource}">
<c:CarouselViewControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding LabelText}" TextColor="Black" />
</DataTemplate>
</c:CarouselViewControl.ItemTemplate>
</c:CarouselViewControl>
</Grid>https://stackoverflow.com/questions/45599456
复制相似问题