Missing PCL dll (ServiceStack.Pcl.Net45)?


I’m creating a new Nuget package which targets PCL and I am trying to test it before I can release it. My Nuget package is fairly simple: it contains my PCL dll and a reference to ServiceStack.Client.

In my test PCL project I referenced my Nuget package and it install the expected dependencies: ServiceStack.Client package, folder portable-net45+win8+monotouch+monoandroid+xamarin.ios10. It uses that folder because my test project is a ‘pure PCL’ project, it is not a winstore or xamarin project.

While executing my test project I get a NullReferenceException from ServiceClientBase and I found that PclExportClient.Instance is null which causes the exception. In PclExportClient's static constructor it tries to initialize Instance with this code:

PclExportClient.ConfigureProvider("ServiceStack.Net40PclExportClient, ServiceStack.Pcl.Net45");

However the ServiceStack.Client package does not contain this Dll. Do I need to reference another Nuget package to have this Dll?

You can bind against a PCL package, but it’s not executable without ServiceStack.Client being installed on a platform which is what contains the platform-specific implementations for the exported APIs that are not available in PCL.

If it’s not wiring the implementation automatically you can manually configure the Platform Specific implementation by calling Configure() on the static class, e.g. for .NET 4.5: