Search code examples
nuget.net-6.0maui.net-mauixamarin-community-toolkit

Error when installed Xamarin.CommunityToolkit: "The target platform must be set to Windows"


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 2.4.1.1, 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:

csproj1

csproj2

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


Solution

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