如何在Xamarin studio中添加nuget包

本文关键字:添加 nuget studio Xamarin | 更新日期: 2023-09-27 18:07:20

我是xamarin studio的新手。我正在尝试添加一个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配置文件没有效果。我不确定如何确定应该使用哪个配置文件

如何在Xamarin studio中添加nuget包

这个包只针对"Xamarin.iOS"。你不能在PCL中引用它,因为任何其他平台都无法使用它。

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

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