Forum Xamarin.Forms

How can I create a common library?

EnricoRossiniEnricoRossini USMember ✭✭✭✭

Hi guys,
my question is easy, I think. In my solution, I used to create different projects, for example, one for data logic (layer), business logic, etc.

Now, I have to create a library not only for my projects but also an SDK for third parties. I'm not sure if I create a PCL library, my third parties can use it in shared projects. In this library, I have to call HttpClient and I should use Refit and Polly.

I read on Xamarin Help that Portable Class are obsolete. Really?

Any advice? Thank you in advance.

Answers

  • AlanStrattonAlanStratton USMember ✭✭

    The old PCL is obsolete, replaced by .NET Standard class libraries. Read h***s://docs.microsoft.com/en-us/dotnet/standard/net-standard.

    You can create .NET Standard 1.0 class libraries and they have the most flexibility in terms of working with different .NET framework versions. However this standard has a limited Api. If you use a .NET STandard 2.0 class library, it now has access to a very full Api, however these class libraries are more limited in what they work with.

    I personally create .NET Standard 2.0 libraries to house my EF Model and Business logic.

    Have fun!

Sign In or Register to comment.