0

Hello I'm new to Xamarin, I'm trying to install the System.Net.Http to a Xamarin portable project using NuGet Package Manager. However, whenever I try to download it I get this error

Could not install package 'System.Net.Http 4.3.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author

I tried every possible version of the package with no use. Could anybody provide some assistance?

3 Answers 3

3

Actually the way I managed to solve this problem was weird I found a referenced assembly called

.NET --> right click View in object browser --> select System.Net.Http --> clicked add reference to the selected project

and the reference is added

Sign up to request clarification or add additional context in comments.

1 Comment

that is completely bizarre, txs for pointing it out. you add a reference the same way for 10 years and then all of a sudden this shows up.
1

Have you tried to install Microsoft.Net.Http? I use it in my PCL Xamarin Forms apps.

3 Comments

which profile are you targeting? Mine is PCL 4.5, Profile 78
@AlessandroCaliaro, what the diference between Microsoft.Net.Http and System.Net.Http. Can i to instance client object like system.net.http and to consume a restfull service?
I installed Microsoft.Net.Http and works fine. Solved!
1

This can be resolved by changing the profile number for the PCL project. Personally, i would untick all the unneeded target frameworks by going to: Project Options -> Build - General - Change Targets.

In my case i have unticked Windows Phone silverlight 8 and the profile number got changed from PCL 4.5 Profile 259 to PCL 4.5 Profile 111 as shown in this screenshot:

Visual Studio 2017 For Mac

After doing so System.Net.Http can be added easily.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.