2016-05-01 50 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。