How to fix Error MSB4062: The "Xamarin.Android.Support.Tasks.VectorDrawableCheckBuildToolsVersionTask"

Jamal 5 Reputation points
2023-07-18T13:26:34.4033333+00:00

Hi everyone,

I am currently working on migrating our Xamarin.Forms project into .Net MAUI. I created new MAUI App project and I was able to build and run that project in both platforms(Android & iOS). after that I have copied Android platform specific codes from older Xamarin Forms Android project and pasted the code into MAUI project Platform/Android directory. While running the project in Android device I am getting below error

/Users/jamal/.nuget/packages/xamarin.android.support.vector.drawable/28.0.0.3/build/monoandroid90/Xamarin.Android.Support.Vector.Drawable.targets(3,3): Error MSB4062: The "Xamarin.Android.Support.Tasks.VectorDrawableCheckBuildToolsVersionTask" task could not be loaded from the assembly /Users/jamal/.nuget/packages/xamarin.android.support.vector.drawable/28.0.0.3/build/monoandroid90/Xamarin.Android.Support.Tasks.VectorDrawable.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. (MSB4062) (MigrationProject)

I have tried few workarounds like cleaning the bin and obj directory, restarting the visual Studio for Mac and restarting Mac machine but these couldn't help to resolve the above built issue.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,340 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.