0

I was trying to create a common library for using HttpClient to consume an API. I was planning to make it in .net standard so as to share it with my xamarin.forms project right now and any future ones. However the highest version of .net standard I managed to use was 1.0. HttpClient needs standard2.0. I have included the latest version of .netstandard nuget into my xamarin.forms.

I have noticed that xamarin.forms runs in net4.5. According to the documentations the max I can go with this is standard1.1. Is there any work around around these to a .net standard common project or is my only option to make a .net framework project/xamarin portable library?

Neville Nazerane
  • 6,622
  • 3
  • 46
  • 79
  • https://blog.xamarin.com/xamarin-forms-stable-comes-to-net-standard-2-0/ Check this link - It might help you – Dilmah Nov 03 '17 at 10:31
  • thanks, but nop. it doesn't work. I have tried with the same version, but it doesn't allow since xamarin.forms is still in net4.5 – Neville Nazerane Nov 03 '17 at 10:42

2 Answers2

0

I used to be in the same situation and I managed to pull through this. First I tried to upgrade my current PCL project to .netStandard, but it was always failing, so I decided to create a new Project A Class Library (.NETStandard), moved all my files to the new project and re-install all nuget packages.

New project configuration:

  • Target Framwork: .NET Standard 2.0
  • Output type: Class Library

Make sure you're using Microsoft Visual Studio > version 15.3

Hope it helps.

Sébastien Lemieux
  • 103
  • 1
  • 1
  • 8
0

I did manage to get HttpClient working in .net standard after manually importing the class. It needed an additional reference which is why it threw an error when I downgraded from .netcore.

This seems to work sometimes and throws reference errors other times. These errors go when I close and re-open visual studios.

Neville Nazerane
  • 6,622
  • 3
  • 46
  • 79