无法将NuGet包安装到PCL - “包不包含任何与该框架兼容的程序集引用或内容文件”

时间:2018-02-09 11:11:28

标签: xamarin xamarin.forms nuget

我正在尝试遵循有关在Xamarin Forms中使用Web服务的教程。我创建了一个新项目,并尝试安装Refit,但这不起作用,所以我尝试安装RestSharp。我可以将这两个库安装到我的Droid / iOS项目中,但不能安装到PCL上。我在Visual Studio中收到以下错误:

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

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

我找到this post on the xamarin forums,但它没有解决我的问题。我的项目很新鲜,一切都是最新的...有谁知道如何解决这个问题?

vents XF应该能够更快地开发跨平台应用程序。更简单,但我认为我已经在本机ios / droid中完成了两次这个poc,因为我把它安装到一个空白项目中! :)

1 个答案:

答案 0 :(得分:0)

这是因为RestSharp与PCL库不兼容。所以你必须处理你在特定平台上尝试做的任何事情。