对于Xamarin的.Net标准2.0 ModernHttpClient的替代选项

问题描述 投票:1回答:1

我已经老项目,该项目是在Xamarin.Form V2.5。这是它被废弃了PCL项目。我是想升级但ModernHttpClient无法正常工作。这表明,该DLL将无法正常工作。

enter image description here

我有以下这是基于ModernHttpClient代码。任何机构可以请建议如何处理这个在.net 2.0标准的DLL不正确添加?

internal class AuthenticatedHttpClientHandler : NativeMessageHandler
{
    public AuthenticatedHttpClientHandler()
    {
        CookieContainer = new CookieContainer();
    }

    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
        CancellationToken cancellationToken)
    {
        using (var cts = new CancellationTokenSource(System.TimeSpan.FromSeconds(30)))
        {
            var response = await base.SendAsync(request, cts.Token).ConfigureAwait(false);
            return response;
        }
    }
} 

请建议

xamarin.forms .net-standard-2.0
1个回答
2
投票

任何机构可以请建议如何处理这个在.net 2.0标准的DLL不正确添加?

如果你只是安装ModernHttpClient到IOS / Android的/ UWP,这里就problem.From official sampleModernHttpClient在本地平台使用:

enter image description here

解:

卸下安装在表单解决方案的NuGet,只是安装的每个本地平台,那么这将WARNNING遵循disappear.As:enter image description here

右键单击根解决方案项目 - >管理NuGet包的解决方案。 - >选择需要的本地平台安装ModernHttpClient,不要选择形式的项目选项

© www.soinside.com 2019 - 2024. All rights reserved.