0
votes

I installed from Nuget the Xamarin Forms Carousel view

however I am getting 2 errors:

1) Failed to resolve assembly: 'Xamarin.Forms.CarouselView, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

2) The "ResolveLibraryProjectImports" task failed unexpectedly. System.IO.FileNotFoundException: Could not load assembly 'MashamApp, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?

<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>
2
Did you install the NuGet package in all projects i.e. the shared project AND the Android project?Steve Chadbourne

2 Answers

0
votes

I can't recommend any code changes since yours looks fine, however Xamarin.Forms.CarouselView, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null looks a little suspect to me. What I would recommend is making sure you have all your references working properly(no yellow triangle by the reference in the project) maybe try reinstalling all your packages with the nu get package manager console command

Update-Package

You can also restrict this down to one project.

Update-Package -Project YourProjectName

If you want to reinstall the packages to the same versions as were previously installed then you can use the -reinstall argument with Update-Package command.

Update-Package -reinstall

I took some of this from this answer How do I get NuGet to install/update all the packages in the packages.config?.

Hope this helps! If not let me know and I'll remove the answer(I had to use an answer because I can't comment under 50 rep) Cheers!

0
votes

well, appearnly they change the name of the namespace and the name of the controll the code shuold be look like this:

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