Error:Xamarin.Forms targets have been imported multiple times

自闭症网瘾萝莉.ら 提交于 2020-05-15 19:44:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!