[英]The type 'IAsyncOperationWithProgress<,>' is defined in an assembly that is not referenced.
In my Xamarin.Forms
project i am trying to use HttpClient
of Windows.Web.Http
. 在我的
Xamarin.Forms
项目中,我尝试使用Windows.Web.Http
HttpClient
。 I have to use that because i need to ignore some SSL errors. 我必须使用它,因为我需要忽略一些SSL错误。 When i create a
HttpClient
object and try to call a method i get this error message: 当我创建
HttpClient
对象并尝试调用方法时,出现以下错误消息:
Error CS0012 The type 'IAsyncOperationWithProgress<,>' is defined in an assembly that is not referenced.
错误CS0012在未引用的程序集中定义了类型'IAsyncOperationWithProgress <,>'。 You must add a reference to assembly 'Windows.Foundation.FoundationContract, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
您必须添加对程序集“ Windows.Foundation.FoundationContract,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = null,ContentType = WindowsRuntime”的引用。
I ve done some research and tried everything i found but couldnt fix it. 我进行了一些研究,并尝试了所有发现但无法修复的问题。 How can i fix this ?
我怎样才能解决这个问题 ? Any help would be appreciated.
任何帮助,将不胜感激。
In my Xamarin.Forms project i am trying to use HttpClient of Windows.Web.Http.
在我的Xamarin.Forms项目中,我尝试使用Windows.Web.Http的HttpClient。 I have to use that because i need to ignore some SSL errors.
我必须使用它,因为我需要忽略一些SSL错误。 When i create a HttpClient object and try to call a method i get this error message.
当我创建HttpClient对象并尝试调用方法时,出现此错误消息。
You're using the Windows.Web.Http
namespace is platform specific. 您正在使用
Windows.Web.Http
命名空间是特定于平台的。 The underlying implementation relies on the WindowsRT platform. 基础实现依赖于WindowsRT平台。 Thus it is not cross-platform.
因此,它不是跨平台的。
We recommend use System.Net.Http
HttpClient module to make REST API calls in the Xamarin.Forms application. 我们建议使用
System.Net.Http
HttpClient模块在Xamarin.Forms应用程序中进行REST API调用。 For more you could refer to Using HttpClient with Xamarin.Forms . 有关更多信息,请参阅将HttpClient与Xamarin.Forms一起使用 。
Usage 用法
HttpClient client = new HttpClient();
var res = await client.GetAsync("http://localhost:5000/api/todo/items");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.