[SOLVED] Error when installed Xamarin.CommunityToolkit: “The target platform must be set to Windows”


This Content is from Stack Overflow. Question asked by Morbid

I’m trying to install Xamarin.CommunityToolkit(ver. 2.0.5) from Nuget Packages,
but I get this error message:

dependency error

So I installed Xamarin.AndroidX.Lifecycle.LiveData with version, as it says
then I tried to install CommunityToolkit again, and again I’ve got the same message but with different compliant.
This time it wants me to install Xamarin.Google.Android.Materia(1.6.0).
I repeated the process a couple of times, and finally I was able to install CommunityToolkit successfully,
but then, when I build the project I get this:

build failure

I don’t know what should I change to get rid of this error, it was working all fine before I installed this CommunityToolkit package

Here’s my .csproj file:


I did try to add “net6.0-windows” to tag with various combinations, but with no effect.
Problem repeats on a newly created project aswell.
I’m using Microsoft Visual Studio Community 2022 (64-bit) Version 17.3.4

Thank you in advance.


For MAUI use CommunityToolkit.Maui package instead of Xamarin.CommunityToolkit.

This Question was asked in StackOverflow by Morbid and Answered by Cfun It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?