是否存在与可移植类库一起使用的RestSharp实现? [英] Is there a RestSharp implementation that works with Portable Class Libraries?
问题描述
当我尝试使用nuget将RestSharp添加到可移植类库项目时,我得到以下信息:
When I try to add RestSharp to a portable class library project using nuget, I get the following:
无法安装软件包"RestSharp 104.1".您正在尝试安装 将该软件包打包成一个针对目标的项目 '.NETPortable,Version = v4.0,Profile = Profile104',但该软件包确实 不包含任何程序集引用或内容文件 与该框架兼容.有关更多信息,请联系 软件包作者.
Could not install package 'RestSharp 104.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile104', 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.
我认为那不被支持?如果是这样的话,有人对如何使它起作用有任何建议吗?
I assume then it is not supported? If that be the case anyone have any suggestions on how to get this to work?
推荐答案
另一个有趣的选择是花粉
Flurl是一个现代,流畅,异步,可测试,可移植,带有流行词的URL构建器和HTTP客户端库.
Flurl is a modern, fluent, asynchronous, testable, portable, buzzword-laden URL builder and HTTP client library.
代码段:
var result = await "https://api.mysite.com"
.AppendPathSegment("person")
.SetQueryParams(new { a = 1, b = 2 })
.WithOAuthBearerToken("my_oauth_token")
.PostJsonAsync(new { first_name = "Frank", last_name = "Underwood" })
.ReceiveJson<T>();
这篇关于是否存在与可移植类库一起使用的RestSharp实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!