Error XF001: Xamarin.Forms targets have been imported multiple times

If you’re in the process of updating a Xamarin.Forms app to a more modern style project set up (NET Standard 2.0, PackageReference, etc), you may get the following error.

 

Error XF001: Xamarin.Forms targets have been imported multiple times. Please check your project file and remove the duplicate import(s).

 

This can be because of the move to using PackageReference for your NuGet packages and a simple fix awaits you.

  1. Close Visual Studio and navigate to the Solution in File Explorer
  2. Delete the hidden .vs folder
  3. Go into each affected project sub folder and delete the following files; project_name.nuget.props and project_name.nuget.targets
  4. Open the solution in Visual Studio, do a Clean and Rebuild, 

 

You should no longer see the error and be able to deploy.

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.