2014-12-07 199 views
0

我正在開發一個使用Xamarin Android的Android MonoGame應用程序。該項目的設置如下: enter image description hereNuGet安裝FarseerPhysics.Portable包錯誤

嘗試安裝時Farseer物理便攜使用的NuGet我得到以下錯誤:

PM> Install-Package FarseerPhysics.Portable 
'FarseerPhysics.Portable 3.5.1' already installed. 
Adding 'FarseerPhysics.Portable 3.5.1' to MyGameAndroid. 
Install-Package : Could not install package 'FarseerPhysics.Portable 3.5.1'. You are trying to install this package into a project that targets 
'MonoAndroid,Version=v2.3', 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. 
At line:1 char:1 
+ Install-Package FarseerPhysics.Portable 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [Install-Package], InvalidOperationException 
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand 

,當我嘗試安裝BugSense.Xamarin.Android也會發生這種情況。我懷疑錯誤消息是不正確的,因爲我能夠在另一個項目中安裝相同的包,它與當前的具有相同的確切設置。

回答

2

FarseerPhysics.Portable與MonoAndroid項目兼容。我可以將它安裝到MonoAndroid項目中。

FarseerPhysics.Portable只包含一個可移植的類庫。所以,如果你看到的錯誤:

Could not install package 'FarseerPhysics.Portable 3.5.1'. You are trying to install this package into a project that targets 

「MonoAndroid,版本= V2.3」,但包不包含任何程序集引用或與該框架兼容的內容文件。欲瞭解更多信息,請聯繫軟件作者 。

此錯誤通常由一種或兩個以下的:

  1. Xamarin移植類庫配置文件不安裝。
  2. 舊版本的NuGet包管理器安裝在Visual Studio中,該工具無法將MonoAndroid識別爲目標框架。

對於1)檢查是否有以下目錄中Xamarin.Android.xml文件:

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

對於2)檢查您是否可以從Visual Studio的擴展管理器的任何更新的NuGet您可以通過選擇擴展和更新從工具菜單打開,然後選擇更新選項卡。

請注意,NuGet提供兩個FarseerPhysics Portable NuGet軟件包。其中一個可以安裝到任何項目中,另一個需要安裝Xamarin Portable Class Library配置文件。