无法更新nuget包(PCL)

时间:2018-02-19 15:26:50

标签: c# android xamarin xamarin.forms visual-studio-2017

在Android中使用地图时出现此错误:

System.MissingMethodEsception: Method
'Xamarin.Forms.maps.Android.MapRenderer.OnCameraChange' not found.

我已经读过你可以更新nugetpackage来解决这个问题。但是,我无法安装它:

Could not install package 'TK.CustomMap 2.0.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', 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.

软件包安装的更新只能在iOS和Android中找到,但不适用于PCL。我试图删除所有的包,然后尝试添加TK.Customs nuget包,但同样的问题。

还试图将它安装在一个新项目上并且安装得很好。只是不能让它安装在我的旧项目上。

尝试更新软件包时出现以下错误消息:

 Attempting to gather dependency information for package 'TK.CustomMap.2.0.1' with respect to project 'Vernamo', targeting '.NETPortable,Version=v4.5,Profile=Profile78'
  GET https://api.nuget.org/v3/registration3-gz-semver2/tk.custommap/index.json
  OK https://api.nuget.org/v3/registration3-gz-semver2/tk.custommap/index.json 175ms
Total number of results gathered : 29
Gathering dependency information took 232 ms
Summary of time taken to gather dependencies per source :
https://api.nuget.org/v3/index.json -   204.03 ms
Attempting to resolve dependencies for package 'TK.CustomMap.2.0.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'TK.CustomMap.2.0.1'
Resolved actions to install package 'TK.CustomMap.2.0.1'
Found package 'TK.CustomMap 2.0.1' in '/Users/holger/Downloads/Vernamo/packages'.
For adding package 'TK.CustomMap.2.0.1' to project 'Vernamo' that targets 'portable45-net45+win8+wp8'.
Install failed. Rolling back...
Package 'TK.CustomMap.2.0.1' does not exist in project 'Vernamo'
Executing nuget actions took 52 ms
Could not install package 'TK.CustomMap 2.0.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', 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.

1 个答案:

答案 0 :(得分:1)

TK.CustomMap 的预发布版本(至少 pre2 )支持所有平台(参见here),无论如何,从开始pre3 (参见here),显然对所有平台的支持都被取消了,转而支持.NET Standard(在这种情况下为1.1)。

您在PCL中使用的配置文件似乎与.NET Standard 1.1不兼容,因此NuGet无法添加引用。您可能会尝试切换到另一个配置文件(例如.NET 4.5.1),但我不知道这是否有帮助。另一种选择是将项目迁移到.NET Standard。这是一项愚蠢的,重复性的任务,但它是可能的。