Xamarin.Forms could not install package

允我心安 提交于 2019-12-19 05:11:15

问题


When creating a new solution within Xamarian studio I get this error

Could not install package 'Xamarin.Forms 1.0.6186'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5,Profile=Profile78', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Is there a certain version of .Net that Xamarian Forms requires for it to be included in the solution? I've tried searching in their documentation but I'm only seeing marketing and not real in depth documentation.


回答1:


I had a similar issue using Visual Studio and I've found that the following combination in the PCL works:

  • .NET Framework 4.5
  • Windows Phone Silverlight 8
  • Xamarin.Android
  • Xamarin.iOS



回答2:


You have created the wrong project type, you created a normal Windows app, and I assume you are targeting iOS/Android or Mac.

Create the project with the correct type and it should work correctly.




回答3:


If you are using Xamarin Studio for Windows (without also having Visual Studio installed) you need to download the Portable Library Tools. See the Xamarin doc Introduction to Portable Class Libraries.




回答4:


I had the same problem with my Xamarin project. The problem was, that in the portable Xamarin project Windows Phone Silverlight was set as target. The PCL project from which I created the nuget, didn't reference Silverlight as target. I don't need Silverlight, so uninstalling all nuget packages from my portable Xamarin project, removing silverlight as target and reinstalling the NuGet packages solved it.




回答5:


I had similar issue using VS and I found solution here - http://forums.xamarin.com/discussion/29674/xamarin-forms-dll-cannot-be-installed

"It looks like your NuGet Package Manager needs to be upgraded. The Xamarin PCL Profiles are installed but NuGet is not recognising Xamarin.iOS as a target framework. You can update NuGet by selecting Tools - Extensions and Updates, then select the Updates tab, then select Visual Studio Gallery. Then update NuGet from there."




回答6:


I have invested a lot of time trying all the solutions posted here, but none of them helped me... Here is the solution that worked for me (on Windows 10):

1.) Open your .csproj file

2.) Find the TargetFrameworkProfile entry

3.) This entry contains Profile78 for me, therefore I open the folder below

c:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETPortable/v4.5/Profile/Profile78/SupportedFrameworks

4.a) If the folder does not exist, then use one of the solutions posted here to install the PLC right on your PC

4.b) Unfortunately, ASP.NET and Xamarin don't like each other, therefore delete all ASP profiles from this folder. For me it was ASP.NET Core 5.0.xml. Obviously this will break your ASP.NET support in VS

5.) Restart Xamarin and have fun!

interesting reading about all that: https://forums.xamarin.com/discussion/52846/cannot-create-new-xamarin-forms-project-pcl-in-xamarin-studio-win10-vs2015



来源:https://stackoverflow.com/questions/23958086/xamarin-forms-could-not-install-package

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