是开放的我们在其他一些总成系统相比.NET 3.5中可用,或者我怎么能在这RestSharp code解决乌里否则? [英] Is Uri available in some other assembly than System in .NET 3.5, or how can I resolve Uri in this RestSharp code otherwise?

查看:636
本文介绍了是开放的我们在其他一些总成系统相比.NET 3.5中可用,或者我怎么能在这RestSharp code解决乌里否则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得RestSharp的裸露的骨头咬了我的Windows CE / Compact Framework的3.5应用程序。

I am trying to get a bare bones bit of RestSharp into my Windows CE / Compact Framework 3.5 app.

这简约code:

RestClient client = new RestClient("http://192.164.144.42:72921/");
RestRequest request = new RestRequest("api/vendorItems/", Method.GET);
RestResponse response = client.Execute(request) as RestResponse;
string content = response.Content; // raw content as string

...先造成一个问题,因为我不得不改变这一点:

...first caused a problem because I had to change this:

RestResponse response = client.Execute(request);

...这样的:

...to this:

RestResponse response = client.Execute(request) as RestResponse;

......但是尽管小胜,该行仍然不能编译:

...but notwithstanding that minor victory, this line still won't compile:

RestRequest request = new RestRequest("api/vendorItems/", Method.GET);

......告诉我,的类型的System.Uri在未被引用的程序集中定义。必须添加对程序集系统,版本= 2.0.0.0

我有系统的引用,但它是3.5.0.0版本(运行版本== V2.0.50727)

I do have System referenced, but it is version 3.5.0.0 (Runtime version == v2.0.50727)

我能做些什么来得到该行没有降级我的系统参考(这无疑会导致编译器鸣叫约其他线路的code)来编译?

What can I do to get that line to compile without downgrading my System reference (which would doubtless cause the compiler to squawk about other lines of code)?

在VS 2008中,我得到很多犯错的MSG从编译器挠头有关新的语言结构,比如异步的事情所产生的;在VS 2013年,我得到:

In VS 2008, I get lots of err msgs emanating from the compiler scratching its head about new language constructs, such as async things; In VS 2013, I get:

...然后:

而在VS 2013 RC,它说:(不兼容)[CRLF + Tab键]这个项目是不兼容的iwth的Visual Studio的最新版

And in VS 2013 RC it says: "(incompatible) [crlf+Tab] This project is incompatible iwth the current edition of Visual Studio"

推荐答案

RestSharp最新版本的使用SimpleJson进行序列化和反序列化。 SimpleJson没有一个CF版本,但它确实有一个FFX 2.0版本所以它是pretty的接近CF标准。有一些的TryParse调用必须更换,但所有功能于所有不坏。

The latest versions of RestSharp use SimpleJson for serialization and deserialization. SimpleJson doesn't have a CF build, however it does have an FFX 2.0 build so it's pretty close to CF-compliant. There are a few TryParse calls that you have to replace, but all-in-all not bad.

我的建议是:

  1. RestSharp源从GitHub上
  2. 创建目标CF 3.5一个全新的智能设备项目被称为RestSharpCF或任何
  3. 从RestSharp根文件夹中已有code文件添加到您的项目
  4. 编译
  5. 修正编译器错误
  6. 在迭代的4安培; 5,直到它实际上建立干净
  7. 部署
  8. 请拉请求来获取更改回到流。预警,你要拉请求到SimpleJson,不RestSharp。
  1. Pull the RestSharp source from GitHub
  2. Create a brand-new Smart Device project targeting CF 3.5 called RestSharpCF or whatever
  3. Add the existing code files from the RestSharp root folder to your project
  4. Compile
  5. Fix the compiler errors
  6. Iterate on 4 & 5 until it actually builds clean
  7. Deploy
  8. Do a pull request to get your changes back into the stream. Forewarning, your have to pull request back to SimpleJson, not RestSharp.

我很可能会做这些步骤自己在未来一个月左右(我已经通过#7确实有,但我也有其他的修改和补充,以及),但它可能不是最好挂出等待我去找时间这一点。我必须完成一个使用RestSharp以确保我拥有所有必要的改变之前,我会尽我拉入请求的ORM实现。

I'll likely do these steps myself in the next month or so (I've got through #7 actually, but I also have other changes and additions as well) but it's probably not best to hang out waiting on me to find time for this. I have to finish an ORM implementation that is using RestSharp to make sure I have all the needed changes before I'll do my pull request.

这篇关于是开放的我们在其他一些总成系统相比.NET 3.5中可用,或者我怎么能在这RestSharp code解决乌里否则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆