简体   繁体   English

类型'IAsyncOperationWithProgress <,>'在未引用的程序集中定义。

[英]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一起使用

  • Install the package Microsoft.Net.Http from Nuget -> For making REST API calls 从Nuget安装软件包Microsoft.Net.Http->用于进行REST API调用
  • Install the package Newtonsoft.Json from Nuget -> For Serialization/Deserialization of objects. 从Nuget->安装软件包Newtonsoft.Json,用于对象的序列化/反序列化。

Usage 用法

HttpClient client = new HttpClient();
var res = await client.GetAsync("http://localhost:5000/api/todo/items");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 类型“ IReportServerCredentials”在未引用的程序集中定义。 - type 'IReportServerCredentials' is defined in an assembly that is not referenced. 类型“ DbConnection”在未引用的程序集中定义。 我无法添加参考? - The type 'DbConnection' is defined in an assembly that is not referenced. I cannot add the reference? “IEnumerable &lt;&gt;”类型在未引用的程序集中定义。 System.Runtime - The type 'IEnumerable<>' is defined in an assembly that is not referenced. System.Runtime 在未引用的程序集中定义类型“ x”。 VS 2010 C# - The type “x” is defined in an assembly that is not referenced. VS 2010 C# “System.Object”类型在未引用的程序集中定义。 您必须添加对程序集 .netstandard 的引用 - The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard 为什么我得到:“IThirdParty”类型是在未引用的程序集中定义的。 您必须添加对程序集“ThirdPartyAssembly”的引用吗? - Why am I getting: The type 'IThirdParty' is defined in an assembly that is not referenced. You must add a reference to assembly 'ThirdPartyAssembly'? “组件”类型是在未引用的程序集中定义的。 您必须添加对程序集“System.ComponentModel.Primitives”的引用 - The type 'Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ComponentModel.Primitives' “MarshalByRefObject”类型是在未引用的程序集中定义的。 您必须添加对程序集 &#39;mscorlib, Version=4.0.0.0 的引用 - The type 'MarshalByRefObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0 类型“ System.Data.Common.DbTransaction”在未引用的程序集中定义。 您必须添加对程序集的引用 - The type 'System.Data.Common.DbTransaction' is defined in an assembly that is not referenced. You must add a reference to assembly 获取“类型&#39;SpatialReference&#39; 是在未引用的程序集中定义的。” 仅当优化代码未选中时 - Getting "The type 'SpatialReference' is defined in an assembly that is not referenced." ONLY when optimize code is unchecked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM