2016-05-01 53 views
0

有没有人在添加Xamarin.Forms包通过“添加NuGet包”选项时遇到此错误?Xamarin.Forms包Erorr

PS我正在使用Xamarin Studio我只在Windows上遇到过这种情况。

错误消息:

Could not install package 'Xamarin.Forms 2.2.0.31'. 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.

Here is the screenshot

+0

你能提一下你到目前为止所采取的步骤吗?你创建了什么类型的项目? – Sreeraj

+0

@Sreeraj,所以我所做的就是使用** Portable Class Library **开发一个Xamarin.Forms应用程序。似乎我在PCL方面有问题。 – jmieaguinaldo

回答

4

您具有具有便携类的轮廓Profile78 .Profiles是你的便携类的类型,你选择哪一个可以使用目标的项目PCL。您选择得越多,可以提供的功能越少。

您需要将其更改为另一个。通常大多数类(包括Xamarin.Forms)支持Profile111。 Profile111是一个配置文件,它不支持配置文件78中的Silverlight。所以你需要去Properties并取消选择Windows Phone Silverlight和Silverlight。您可以选择其他所有内容(.Net 4.5,Windows 8,Windows Phone 8.1,Android,iOS/iOS classic和ASP.NET Core 1)。

然后再次尝试添加Xamarin.Forms。

你可以看到更多信息,包括所有(?)配置文件列表here

这里你可以看到如何在Visual Studio项目属性更改:

enter image description here

在这里,在Xamarin Studio项目选项:

enter image description here

+0

这可以使用Xamarin Studio来实现吗? – jmieaguinaldo

+0

是的,在那里你甚至可以更容易地切换配置文件;) – Matt

+0

Xamarin.Forms 2.2.0.31支持Profile78并在Windows上的Xamarin Studio中成功安装。 –

1

的问题是,你不必Windows上安装的便携式类库(PCL)配置文件。 Xamarin.Forms 2.2.0.31支持Profile78,因此将其更改为Profile111并不能解决问题。

错误信息本身表明这是问题,因为它引用了Profile78。如果NuGet包真的不兼容,则NuGet会在其错误消息中显示PCL配置文件中的框架而不是配置文件编号。如果我尝试Xamarin.Forms 2.2.0.31安装到靶向Profile1的一个PCL项目,不支持Xamarin.Forms然后我得到一个错误:

Could not install package 'Xamarin.Forms 2.2.0.31'. You are trying to install this package into a project that targets 'portable-net40+sl40+win+wp+Xbox40', 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. 

注意Profile1的没有被提及。

上有installing Portable Class Libraries for Xamarin Studio详细的说明,我将总结在这里:

在Windows上安装便携式类库,你有三种选择:

  1. 安装Visual Studio 2013(完全或快速的版本)。以上更新2或 是必需的。安装Portable Library ToolsPortable Library Reference Assemblies 4.6
  2. 安装Portable Library Tools并将Mono的.NETPortable目录复制到Windows。