如何在Xamarin工作室中添加nuget包

时间:2016-09-18 00:37:40

标签: c# xamarin xamarin.ios xamarin-studio

我对xamarin工作室来说是全新的。我正在尝试添加一个nuget包。使用添加包对话似乎工作,但我收到一个错误:

  Attempting to gather dependency information for package 'SidebarNavigation.1.9.0.3' with respect to project 'helloios', targeting '.NETPortable,Version=v4.0,Profile=Profile344'
Attempting to resolve dependencies for package 'SidebarNavigation.1.9.0.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'SidebarNavigation.1.9.0.3'
Resolved actions to install package 'SidebarNavigation.1.9.0.3'
For adding package 'SidebarNavigation.1.9.0.3' to project 'helloios' that targets 'portable40-net45+sl5+win8+wp8+wpa81'.
Install failed. Rolling back...
Package 'SidebarNavigation.1.9.0.3' does not exist in project 'helloios'
Package 'SidebarNavigation.1.9.0.3' does not exist in folder '/Users/********/Projects/helloios/packages'
Could not install package 'SidebarNavigation 1.9.0.3'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile344', 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.

这是包的github页面。

https://github.com/jdehlin/Xamarin-Sidebar

我尝试使用不同的PCL配置文件无效。我不确定如何确定应该使用哪个配置文件。

1 个答案:

答案 0 :(得分:1)

该套餐仅针对" Xamarin.iOS"。您不能在PCL中引用它,而PCL的目标不止于此,因为任何其他平台都无法使用它。

要么不使用PCL,要么将PCL限制为" Xamarin.iOS"。

由于这似乎是一个UI组件,您应该从主项目中引用它,如果需要,可以通过服务向PCL公开一些功能。