3
votes

I am trying to install ModernHttpClient from ManagedNUGet. But after installation completed, it says following warning. I am trying to install in Portable project.

Package 'modernhttpclient 2.4.2' was restored using '.NetFramework, version=4.6.1' instead of the project target framework '.NetStandard,Version=v2.0'. This package may not be fully compatible with your project

enter image description here

2

2 Answers

8
votes

If you're using .NET Standard you don't have to use ModernHttpClient. Just go to properties of your project and select HttpClientHandler implementation.

Android: https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/http-stack?tabs=macos

iOS: https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/http-stack

1
votes

You are probably using a portable class library for your shared project. For a long time that was (and partially still is) the standard type of a shared code library for xamarin (forms).

However, since Microsoft introduced the .Net Standard, developers are encouraged to create .net standard class libraries instead of using the old PCL approach. So a lot of nuget packages get updates which make them compatible with .net standard, however the support for portable class libraries gets dropped.

Basically you have to convert your pcl to a .net standard class library if you want to use that particular nuget package.