The "XamlCTask" task failed unexpectedly on visual studio for xamarin

Delete your old package /[your project root]/packages/Xamarin.Forms.[old version number].


I removed all Xamarin references from ALL projects, removed ALL Xamaring packages. Deleted all mention of Xamarin in PROJ files and readded all nuget packages for Xamarin. (lost days on this) :)


This kind of issue may also come if by mistake you have any syntactical error like in my case: two text cells were present in the ListView -

<ListView x:Name="ProductsView">
    <ListView.ItemTemplate>
        <DataTemplate>
            <TextCell Text="{Binding ProductId}" />
            <TextCell Text="{Binding ProductDescription}" />
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

I went through other posts for this issue and found the same issue occurred due to the presence of syntactical errors, which VS doesn't report directly. So look for this, otherwise, reinstall the compatible version of xamarin.forms -> clean solutions -> rebuild by reopening VS.


This issue arise, if your Xamarin.Form version is not compatible/matching with your NuGet package which you have installed.

So, I have just updated Xamarin.Forms for both xx.Droid and PCL and make the match the dependencies with NuGet package.

Now it is working fine. Hope so this will work for you.