Portable Class Libraries

Jun 14, 2011 at 6:09 PM

Would it make sense to move some of the classes into a mult-target Portable Class Library?  http://msdn.microsoft.com/en-us/library/gg597391.aspx

There's probably some functionality that would have to reside in separate target-specific assemblies, but perhaps the core set could be used as-is across different platforms.

Also, my understanding is that Windows Phone 7.1 is based on Silverlight 4.0, which should increase compability across the different platforms.

Are there any plans for adding support for WP7.1?

Jun 14, 2011 at 7:54 PM

Yes, I will add support for 7.1. I've been talking to the portable library guys. They are trying to improve the situation for framework authors. However, it would still involve me splitting into multiple assemblies...which I don't want to do.

Jun 17, 2011 at 12:19 AM

Now that the Portable Library Tools are RTW...

I think there would be tremendous benefits in supporting this in Caliburn.Micro. In my case, we are using CM in a Silverlight app. The ViewModels are pretty light but there is sufficient code in there that I feel bad about not having ANY tests for them. Existing Silverlight testing solutions are pretty rank (e.g. frequently require running the tests inside a browser, or require using an infrequently maintained fork of NUnit), compared to just testing a regular class library.

Ideally I would extract my ViewModels into a separate assembly/project from my Views and Bootstrapper, and the ViewModel assembly would be a Portable Class Library targeting both Silverlight 4 and .Net 4. Then I can easily write a .Net 4 unit testing project that references the ViewModel assembly via a project reference.

The missing piece for this is for Caliburn.Micro Silverlight 4 version to expose PropertyChangedBase, Screen, IEventAggregator, IHandle, IViewAware (and probably quite a few others!) in a way that they can be consumed by a PCL assembly. I agree this is probably non-trivial however!

I might have a look at this myself and see just how ugly it is to split things apart (if possible at all).

Jun 17, 2011 at 2:49 AM
Edited Jun 17, 2011 at 2:50 AM

First, it's not possible in the current version of the PCL bits. The team is looking into supporting MVVM scenarios better and they have contacted me and other framework authors as part of their investigation. Unfortunately, even with the future changes they *might* make, I would still need to refactor Caliburn.Micro into two assemblies and re-design a number of things so that it was possible. I'll address that issues if/when the PCL releases a version that better supports basic things like INPC and ObservableCollection<T>.

Jun 17, 2011 at 3:59 AM

Oh well, thanks anyway. Maybe MS will come up with a better solution for SL unit testing instead (or maybe the existing solutions aren't as bad as they appear after more detailed inspection than I have been able to give them).

Nov 19, 2012 at 8:38 AM

I realize this question was asked and answered quite a while ago, but with the recent developments of the Portable Class Library concept in VS2012 and Caliburn.Micro now being available for practically all platforms targeted by PCL, I hope it is OK that I raise the question again:

Are there currently any plans for splitting Caliburn Micro into a portable "core" library and platform-specific "UI/View" libraries?


Anders @ Cureos

Nov 19, 2012 at 4:20 PM

I would like to do it. It would be a major overhaul though and can't be justified without moving to a v2.0 release. It's a lot of work and would take some re-engineering..and most likely add complication to the framework. Because the conventions and action messages (and similar pieces) rely on parts of the Xaml frameworks which are not included in the portable libraries...it's probably a very non-trivial task to make this happen and would require adding additional abstractions into the core in order to make the dependencies work out. We will see. I need to do some point releases first now that we have the full platform support...in order to fix bugs and make some minor improvements. Then, when our bug list is almost gone, I'll talk with the team about moving to portable libraries.

Nov 19, 2012 at 5:38 PM

Thanks for a prompt response, and many thanks for (re-)considering this. I think it would add even more value to an already superb MVVM framework :-) 

Either case, GREAT work with Caliburn.Micro and for making it open-source. It has facilitated my work tremendously.

Best regards, Anders

Dec 3, 2012 at 9:02 AM

Is there any eta when a PCL version might be available?

Im looking to use an MVVM framework in a new project, and want to reuse my VM over different views, and to me Caliburn looked to be the best at reducing the amount of code needed.

Jan 4, 2013 at 12:51 PM

Hi  there,

I'm also developing an app for both WinRT and Phone8, we've made quite a lot of headway using PCL to hold the view models that serve both platforms, and are also under complete unit test. We don't have a MVVM framework yet, Caliburn is coming very highly recommended, and I can see why.

I would like to move to Caliburn for both platforms, but I can see straight away there is a problem in having to inherit from ViewModelBase/Screen from the different platform assemblies. However, instead, would it be best to have the ViewModels for each platform, which then function as a Facade to the tested classes in the PCL?

Has anyone done anything like this?  The other solution may be to "Roll my own", as suggested in the original Mix10 video



Jan 5, 2013 at 8:19 PM

I've been messing around with CM lite lite roll your own framework and I've also been messing with MvvmCross.  I have a basic screens and conductors implementation working in MvvmCross.  They live in a PCL so the ViewModels can live there as well.

I might also try and hammer out a CM lite lite that has screens and conductors in a PCL and whatever other stuff can live there and then platform specific libs that have the bootstrappers.  Been busy though and haven't had much time to mess with this.

Jan 6, 2013 at 6:50 AM

I forked CM and created a Portable version.  I'm not sure how well it will work but I have a wp71 and winrt app both pointing to a single portable lib that contains the view models.

Jan 6, 2013 at 4:47 PM


I still have to work out navigation and maybe the way I'm doing it isn't the best.

Jul 11, 2013 at 7:16 PM
I'd really like to see this as well, for what its worth.