在Xamarin表单中找不到system.net.http
在我的xamarin应用程序中,我需要使用HttpClient实现web服务 因此,我创建了测试项目&测试web服务——这里没有问题 我的代码:在Xamarin表单中找不到system.net.http,xamarin,xamarin.forms,Xamarin,Xamarin.forms,在我的xamarin应用程序中,我需要使用HttpClient实现web服务 因此,我创建了测试项目&测试web服务——这里没有问题 我的代码: public async Task<string> registrationRequest() { HttpClient client = new HttpClient(); string response = await client.GetStringAsync(registrationURL);
public async Task<string> registrationRequest()
{
HttpClient client = new HttpClient();
string response = await client.GetStringAsync(registrationURL);
return response;
}
但在我的live项目中,此导入返回错误
有人帮我吗?您需要在PCL和特定于平台的项目中安装nuget软件包。谢谢您解决了这个问题。。一个疑问-在我的测试项目中,我没有安装此。。这在我的测试项目中是如何工作的?您是否可能在测试项目中使用共享代码而不是PCL?没有兄弟。。我正在使用PCL中的代码。在PCL中,此导入在不安装任何库的情况下工作。
using System.Net.Http;