Monday, January 07, 2013

Almost portable binaries....

I'm sure that those who've followed the mvvmcross story so far are already well aware of my ongoing campaign to get more and more portable class library code running across all the Mono platforms - Touch, Droid, Mac, PSVita,... :)

One thing I'm worried I may have mis-stated recently is the binary compatibility of portable class libraries right now.

It is true that I've successfully used the portable Newtonsoft JSON.Net as a binary across a lot of platforms - and it's worked well for me - that's what I meant to state.

What I shouldn't have implied was that all portable binaries will work well for you - they won't... not yet...

For mvvmcross binaries, in particular, please do *not* try to use the MvvmCross dlls built on Windows (for WP, WinRT and MonoDroid) on the Mac for MonoTouch. These sadly, don't work, because:

1. There are often problems at build time - with 'reference assemblies' that MonoTouch MSBuild doesn't yet understand
2. There are then problems at run time - with things like mscorlib issues (see http://stackoverflow.com/questions/14193608/ios-black-screen-and-missingmethodexception-method-not-found-system-type-op-e)

Instead... you must build the portable libraries for MonoTouch instead....

If you don't want to build - if you want an unofficial set of debug binaries instead... then today these sit in a skydrive folder: http://sdrv.ms/URCbYN - note that there are two portable folders: portablePC for VisualStudio projects and portableMac for iOS MonoDevelop projects.

Some new year's resolutions for you:
  • I will try to work on getting official releases of mvvmcross out and published
  • I will try to get these released via nuget too
  • I will keep reporting issues to MS and Xam about PCLs - in the hope this leads to better and better support.
Sorry, the PCL situation isn't yet really good. The situation today is way better than it was a year ago... but there's definitely still things to do!

7 comments:

  1. Thanks for your post, but could you reference your MS connect entries, so we can vote them up?

    It is really sad that there is no clear vision or road map from MS for the PCL.

    ReplyDelete
  2. Thanks MiHa

    There are no real connect id's active on this right now. There are quite a few xamarin bugzilla refs - but xamarin don't really seem to roadmap their responses to these.

    Daniel and Dave on the ms team have actually both been very helpful and proactive on getting the mvvmcross PCL code working. Now that's pretty stable, i think most of the current challenges sit with xamarin getting time to work on PCLs, and then on Ms and xamarin together working out a way to share profiles and/or reference assemblies.

    I think the divergent course ms has chosen with rt, phone and desktop development means we'll be seeing more PCL releases from them - but it feels like these will be smaller nuget level increments rather than big roadmapped release... But then, I quite often get these things wrong!

    ReplyDelete
  3. Thanks for the post.

    What versions of Mono and Mono Develop should I use to compile everything on my own?

    I get an error that ICommand does not exist?

    Thanks for the brilliant work!
    D

    ReplyDelete
  4. Hello,

    Thank you for this post. I'm still slightly confused though. Are you saying that if we choose to use something like Json.Net in our app, we need to use a version specifically for MonoDroid and another specifically for MonoTouch? Currently, I have a Portable Class Library that contains my view models. My view models rely on Json.

    When I attempt to manually add a reference to the NewtonSoft library included with MvvmCross, I get a compile-time error that says: "The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)"

    If I attempt to add Json.Net via NuGet, I receive an error that says: "Successfully installed 'Newtonsoft.Json 5.0.3'.
    Successfully uninstalled 'Newtonsoft.Json 5.0.3'.
    Install failed. Rolling back...
    Could not install package 'Newtonsoft.Json 5.0.3'. You are trying to install this package into a project that targets 'portable-win+net45+MonoAndroid16+sl40+net10+wp71', 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."

    What is going on?

    ReplyDelete
    Replies
    1. Can we transfer that question to stackoverflow? Easier to answer there!

      Delete
    2. Sure. I just did so. The question is at http://stackoverflow.com/questions/16120713/unable-to-add-json-net-to-portable-class-library-with-monodroid-and-monotouch

      Thank you!

      Delete
    3. Answered - also edited your question so it made more sense there. It didn't make sense to just cut and paste about t'this post' there

      Delete