2014-12-07 161 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配置文件。