Reputation: 1669
I'm reading that .NET Standard is now preferred over PCL class libraries to share code.
My question is should I use a .NET Standard library over a PCL for the core of a Xamarin Forms solution? Currently, it will target iOS and Android, but we are looking to Tizen for TV in the future.
Upvotes: 2
Views: 470
Reputation: 1421
You can also choose the best of both world by using .Net standard and the PackagetargetFallback attribute in order to be compatible with libraries not officialy compatible with it:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageTargetFallback>portable-net45+win8+wpa81+wp8</PackageTargetFallback>
<PropertyGroup>
<!...>
Upvotes: 4
Reputation: 33993
.NET Standard will be the future, so if you can you should get on board now.
But be aware. If you're planning on using NuGet packages you could run into the situation that a package (or library from another source) does not support .NET Standard yet. Or the other way around is true as well. There are libraries that only support .NET Standard as of now, so you should either install an older version (with all the risks that come with it) or find an alternative path.
Also note; a lot is happening now in .NET Standard (and Core for that matter) land so be prepared for bugs, rough tooling and not all platforms being supported just yet.
Upvotes: 1