Building Xamarin with NetCore

Just trying to do my first Xamarin project in Visual Studio 2017 (15.3.3) and I keep hitting compile errors.

All I have done is to create a default blank Cross Platform App (Xamarin) project with Xamarin.Forms and PCL.

When I tried to add ServiceStack.Client into the portable project, I got errors, and found I had to change the profile from Profile 259 to Profile7. Is that expected?

Now when I am trying to add my own projects along with a Get call to JsonServiceClient, I am getting

Error CS0012 The type ‘Object’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’

This seems to be an issue that required a NETStandard.Framework library before 2.0.0 was released, but is supposed to be fixed in 15.3 so not required.

Has anyone else come across this or managed to build a project? Are there any basic samples, or can someone upload a project zip, so I can get it started?

Many thanks.

MS have started making PCL incompatible with .NET Core and are upgrading all their libraries to use .NET Standard only. In our next v5 release (after tomorrows v4.5.14 Release) we’ll be dropping PCL builds and targeting .NET Standard 2.0 instead. Their PCL inference may not be working properly as ServiceStack Service Clients are Profile7 PCL library.

You can try using our pre-release MyGet packages as the changes we’ve made to upgrade to .NET Core 2.0 may resolve this issue.

Thanks, I tried that. As a followup, it turned out that I was following a Xamarin tutorial that said you should create a PCL project with Xamarin.Forms. Turns out, you shouldn’t. There is a post at Xamarn saying how to hook in a core project. That made it all work.

1 Like

There’s also a nice write up on Xamarin here discussing the move away from PCL: https://xamarinhelp.com/portable-class-library-pcl-vs-shared-projects/

1 Like