问题
a few hours ago, my solution just builds success, but after that it has error "Xamarin.Forms targets have been imported multiple times." I have struggled with that a whole week.
my project here:
file my project
I didn't see any multiple xamarin.forms at all.
回答1:
This solution might help, we encountered same issue in recent past.
Remove and add packages back will help you.
Steps: Keep back up of your packages.config file. Remove all packages from packages.config file. Close project and open app again. Copy backup file content, Clear project and build again. It will clear issue.
回答2:
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 Delete the hidden .vs folder .
2.Go into each affected project sub folder and delete the following files; project_name.nuget.props and project_name.nuget.targets .
3.Open the solution in Visual Studio, do a Clean and Rebuild.
回答3:
Right click on your project and select Edit Project File
In the section that has all your imports, ie
You will probably find that there are two imports of Xamarin.Forms, ie ...packages\Xamarin.Forms...
You can delete one of them.
来源:https://stackoverflow.com/questions/54683961/errorxamarin-forms-targets-have-been-imported-multiple-times