Search code examples
c#androidiosxamarinportable-class-library

Can PCLs created in Visual Studio be used in Xamarin projects?


I created a Portable Class Library the other day in VS2013. It targeted the following platforms:

  • .NET Framework 4.5
  • Windows 8.1
  • Windows Phone 8.1 (non-Silverlight)

My question is, can this be used in Xamarin projects such as Xamarin.iOS or Xamarin.Android? I've found a project claiming to support Xamarin, but grepping the solution and project files for "ios" and "android" turn up nothing. If not, what can I do to make my library portable to those platforms?

Thanks.


Solution

    1. You need to install Xamarin for Visual Studio first if you haven't already
    2. Open your PCL project and change the target profile to include the Xamarin platforms you want to support. (e.g. Profile 78)
    3. Optionally retarget all your dependencies (projects/nugets)
    4. Recompile your PCLs

    You should now have dlls that work also in Xamarin.