0
votes

I need to create a reusable Xamarin Forms control that will be used in two separate projects. It does require custom renderers for IOS and Android. The problem is I cannot figure our what kind of project to use to create a reusable custom control library for Xamarin forms.

Every site seems to talk about creating customer controls that can be reusing in the same project. But I need it in a separate project for reuse.

Can someone please point me in the right direction.

1
use a .NET Standard library for the shared Forms library. VS Mac has a "Multiplatform LIbrary" template, I don't know if VS2019 has the same thing. - Jason
.Net Standard lets me share code but I need to create controls with custom renderers. Also windows does not appear to have the multiplatform library template - Christopher James Woods
you will have libraries for each platform and a shared library with any common code - Jason

1 Answers

0
votes

Depending what are your needs regarding multi-targeting, using a solution with a shared project of type MSBuild.Sdk.Extras could be very helpful. You can then packed your shared project into a package that you can reference from your apps project and use locally.

Examples that might guide you and shows you the path are known nuget packages that are being used by app developers cross-platforms, just an example Xamarin.Forms.PancakeView.

Related to MSBuild.Sdk.Extras: How to use different base class in custom control depending on platform target?