Xamarin Studio Suport

Xamarin Studio Suport

Old forum URL: forums.lhotka.net/forums/t/12723.aspx

Jonathan Parker posted on Sunday, August 17, 2014

Hi all,

I am currently evaluating whether to use CSLA in my project.

I'm also new to Xamarin. The plan is to develop for iOS and Android initially.

I have successfully added the Android and iOS CSLA nuget packages to my Xamarin solution but am stuck on adding the CSLA Core package to my PCL project. I get this error

Adding CSLA-Core...

Adding 'CSLA-Core 4.5.601' to MyProject.Domain.

Could not install package 'CSLA-Core 4.5.601'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoAndroid10+MonoTouch10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I then tried creating a Shared project and putting my domain code in there and it seems to work.

Is anyone else doing this? Is this the correct approach?



P.S. I'm excited about using CSLA and Xamarin for the first time.

RockfordLhotka replied on Friday, August 22, 2014

CSLA doesn't currently provide a PCL assembly. The NuGet package has assemblies for all the platforms, and they are created with what is now basically the shared project concept (which behind the scenes is just tooling over the Linked File concept that has been in Visual Studio projects since the beginning).

Creating a PCL hasn't been a priority, because PCLs don't allow customization of code per platform, and CSLA includes some pretty optimized code for full .NET vs some of the more sandboxed platforms.

There is an issue to do this in GitHub now though, because there's a "bait and switch" hack you can use with NuGet to provide a PCL shell without an implementation, where NuGet automatically provides each project with the platform-specific assembly that does contain an implementation.

I'm still debating how much energy to put into that, given that the shared project concept works so well and doesn't require any effort...

Jonathan Parker replied on Friday, August 22, 2014

Thanks for the reply Rocky,

I guess the issue only comes up when you want to use PCL libraries together with CSLA. I'm guessing the Xamarin component gallery will be going down the PCL route rather than the Shared Project route in future. Correct me if I"m wrong.

The 'bait and switch' sounds interesting. I'm guessing that it's the equivalent of an interface assembly except that it supports classes as well which are then 'reimplemented' against the platform specific framework.

I'm not sure the way forward for my project at the moment. I may just have to go ahead with the Shared Project and see how it goes.

Copyright (c) Marimer LLC