Error XF001: Xamarin.Forms targets have been imported multiple times
Posted on October 1, 2018 • 1 minutes • 122 words
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.
- Close Visual Studio and navigate to the Solution in File Explorer
- Delete the hidden .vs folder
- Go into each affected project sub folder and delete the following files; project_name.nuget.props and project_name.nuget.targets
- Open the solution in Visual Studio, do a Clean and Rebuild,
You should no longer see the error and be able to deploy.