PCLs and MvvmCross in the new tools

I can't answer even half the questions I'm being asked in my email inbox. Sorry. So I'm moving the conversation here.

The only thing I know is that Xam hope to demo something about PCLs sometime around the time of Evolve - so we're really close now to having amazing Cross-Platform support :)

Until then, the safest route is probably to use the old Mono tools, VSMonoTouch and the patched version of 3.1.1 - http://slodge.blogspot.co.uk/2013/02/a-patched-monodevelop-for-pcls.html - that's what I'm using right now today.

Alternatively, if you find something that works, please post it here :)

And if you have questions then again ask them here - hopefully someone here will be able to help you out.

We will get there - the future is definitely portable :)

Thanks (sorry I can't help more!)




  • DianeWilsonDianeWilson USMember, Beta

    Full PCL integration pleeeeeeeeeezzzzz!

    There's plenty that I can work on between now and Evolve, since I'm still in learning and demo mode. But before long I'll need to integrate with MvvmCross and ServiceStack across iOS, Android, Win 8, and Win phone 8.

    BTW, the new Xamarin 2.0 looks excellent so far, other than the PCL status.

  • ChWoChWo DEMember

    Thanks for this thread. I didn't try the new tools in order to avoid headaches especially with PCLs.

    I have a working cross platform solution using a PCL project and specific GUI projects for each platform. The PCL project references some MvvmCross PCL binaries. For the iOS project I have to compile the PCL against MonoTouch and need to reference the MvvmCross binaries that have been built against MonoTouch too.
    In order to keep my solution folder portable I'm using conditional compiling inside the .csproj file of my PCL to reference the correct binaries on each platform:

    <ItemGroup> <Reference Include="Cirrious.MvvmCross" Condition="'$(OS)' == 'Windows_NT'"> <HintPath>..\MvvmCross\VS2012\Portable\Release\Cirrious.MvvmCross.dll</HintPath> </Reference> <Reference Include="Cirrious.MvvmCross" Condition="'$(OS)' != 'Windows_NT'"> <HintPath>..\MvvmCross\MonoTouch\Touch\Release\Cirrious.MvvmCross.dll</HintPath> </Reference> </ItemGroup>

    (An example solution can be downloaded here: https://skydrive.live.com/?cid=D3D039F88037AAD4&id=D3D039F88037AAD4!139)

    Now I'm asking myself: Does this setup work with the new Xamarin.iOS plugin for Visual Studio?
    Does the PCL project reference the correct MvvmCross binaries on each platform?
    And do I still need the TargetFrameworkProfile hack inside the PCL project:

    <TargetFrameworkProfile Condition="'$(OS)' != 'Windows_NT'">Profile1</TargetFrameworkProfile> <TargetFrameworkProfile Condition="'$(OS)' == 'Windows_NT'">Profile104</TargetFrameworkProfile>

    I'm afraid to break my setup and spend a lot of hours in testing Xamarin 2.0 and PCL support. If you say my solution doesn't work with the new tooling then it's not a problem. I can stay on the old tools for a while until PCLs are completely supported.

  • valdeterovaldetero USInsider, University ✭✭

    I was able to open the MvvmCross_NoSamples solution after installing Xamarin 2.0. I had to remove the references to to PortableSupport/Touch/System.Windows.Touch project from all of the iOS projects because of the following build error:
    The type 'System.Windows.Input.ICommand' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v4.0\System.dll' and '..\MvvmCross\bin\Touch\Debug\System.Windows.dll'

    I did get a slew of warnings about references, but everything still built.

  • valdeterovaldetero USInsider, University ✭✭
    edited February 2013

    I was able to add the iOS project to @slodge 's Sphero solution. I had to hack another target framework file similar to what he suggested at: http://slodge.blogspot.com/2012/09/mvvmcross-vnext-portable-class.html.

    I added one to target the official MonoTouch framework that Xamarin 2.0 installs.

    Add this file:

    <?xml version="1.0" encoding="utf-8"?>
        MinimumVersion="4.0" />

    to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile104\SupportedFrameworks

    I am all new to this so I have no idea if this runs but it compiles!

    It compiled before I wrote this. When I got back, I had errors. :-/

  • StuartLodgeStuartLodge USBeta ✭✭✭

    Good stuff, Seth

    What are the errors? Together we will get this stuff working... thanks for doing all the work so far!

  • valdeterovaldetero USInsider, University ✭✭

    These are my errors with your Sphero project. I find some of them weird since ICommand and DefaultImagePath are referenced in the assemblies.

    Error   5   'Cirrious.MvvmCross.Plugins.DownloadCache.MvxDynamicImageHelper`1' does not contain a definition for 'DefaultImagePath' and no extension method 'DefaultImagePath' accepting a first argument of type 'Cirrious.MvvmCross.Plugins.DownloadCache.MvxDynamicImageHelper`1' could be found (are you missing a using directive or an assembly reference?) ..\BallControl-master\Cirrious.Sphero.WorkBench\Cirrious.Sphero.WorkBench.UI.Touch\Views\HomeView.cs    38  16  Cirrious.Sphero.WorkBench.UI.Touch
    Error   8   'System.Windows.Input.ICommand' does not contain a definition for 'Execute' and no extension method 'Execute' accepting a first argument of type 'System.Windows.Input.ICommand' could be found (are you missing a using directive or an assembly reference?)   ..\BallControl-master\Cirrious.Sphero.WorkBench\Cirrious.Sphero.WorkBench.UI.Touch\Views\HomeView.cs    41  33  Cirrious.Sphero.WorkBench.UI.Touch
    Error   9   'System.Windows.Input.ICommand' does not contain a definition for 'Execute' and no extension method 'Execute' accepting a first argument of type 'System.Windows.Input.ICommand' could be found (are you missing a using directive or an assembly reference?)   ..\BallControl-master\Cirrious.Sphero.WorkBench\Cirrious.Sphero.WorkBench.UI.Touch\Views\SpheroMovementView.cs  47  31  Cirrious.Sphero.WorkBench.UI.Touch
    Error   12  'System.Windows.Input.ICommand' does not contain a definition for 'Execute' and no extension method 'Execute' accepting a first argument of type 'System.Windows.Input.ICommand' could be found (are you missing a using directive or an assembly reference?)   ..\BallControl-master\Cirrious.Sphero.WorkBench\Cirrious.Sphero.WorkBench.UI.Touch\Views\HomeView.cs    53  34  Cirrious.Sphero.WorkBench.UI.Touch
    Error   4   The type 'Cirrious.MvvmCross.Plugins.DownloadCache.MvxDynamicImageHelper`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'Cirrious.MvvmCross.Plugins.DownloadCache, Version=, Culture=neutral, PublicKeyToken=null'.   ..\BallControl-master\Cirrious.Sphero.WorkBench\Cirrious.Sphero.WorkBench.UI.Touch\Views\HomeView.cs    38  5   Cirrious.Sphero.WorkBench.UI.Touch
    Error   6   The type 'System.Windows.Input.ICommand' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.  ..\BallControl-master\Cirrious.Sphero.WorkBench\Cirrious.Sphero.WorkBench.UI.Touch\Views\HomeView.cs    41  5   Cirrious.Sphero.WorkBench.UI.Touch
    Error   7   The type or namespace name 'RelativePositionParameters' could not be found (are you missing a using directive or an assembly reference?)    ..\BallControl-master\Cirrious.Sphero.WorkBench\Cirrious.Sphero.WorkBench.UI.Touch\Views\SpheroMovementView.cs  41  23  Cirrious.Sphero.WorkBench.UI.Touch
  • I have spent a bit of time getting mvvmcross to the stage of compiling with the Xamarin 2 VS plugin however when it comes to running say Tutorial.UI.Cross it fails without an error message, ie just a red cross in the error panel.

    I disabled the wpf projects as this is currently out of my scope and it did reduce some of the errors.

    Would certainly be interested to know if you manage to get the sphero project to run.

  • StuartLodgeStuartLodge USBeta ✭✭✭

    I am slowly starting to switch over... Just got some existing customer work that can't switch and I don't have a budget for multiple development Macs.

    One of the biggest issues seems to be the strong naming needed now - that stops the existing pre-built assemblies working.

    @valdetero were those build errors with the existing pre-built assemblies (built pre-signing) or with new ones?

    @aheydler there's not much debug info there, is there? If you can't get any other info, then can you post a screenshot and maybe some of the build output. I'll then see if we can attract a Xamarin dev here to help debug that.

  • @StuartLodge believe me if there was more info I would have posted it! there is literally the red cross icon and a timestamp.

    If someone can tell me where any logs might be I will be happy to have a look as I am not yet that familiar with VS.

    Will post a screen shot and the build output when I can.

  • valdeterovaldetero USInsider, University ✭✭

    Those were with the new assemblies. I had a lot more with the existing ones.

  • DeanSchreinerDeanSchreiner UMMember ✭✭
    edited February 2013

    It seems like compilation errors appear because PCLs compile against "wrong" .NET Framework. Here's why I think so - if I create a class that implements ICommand in my MonoTouch project, it compiles and runs just fine. But if I move the same code into PCL and try to consume this class in my MonoTouch project, I get the following:

    error CS0012: The type 'System.Windows.Input.ICommand' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

    I did go all over MvvmCross and remove references to System.Windows. And I am getting this error in Visual Studio on Windows machine when trying to compile the solution with Xamarin.iOS (Xamarin 2.0).

  • AndreasHeydlerAndreasHeydler AUMember

    this is the build log from a complete build of mvvmcross all with the .NetPortable files as described above along with what appears in VS when attempting to run Tutorial.UI.Touch


  • StuartLodgeStuartLodge USBeta ✭✭✭
    edited March 2013

    We've not managed to lure anyone official on to here yet. So I think the best thing to do is to start opening Bugzilla entries on these things. So please start logging them and then link back here too.

    @Xamarin's response to PCL bug reports is really clear - "All our PCL support is really unsupported" - so that might just ignore these Bugzilla reports, but I would expect Xam to want to urgently fix things like an empty error message - it'll be cheaper to make the error message than to answer support calls about it:

    But at the same time as saying PCLs aren't yet supported, I think everyone's now genuinely really keen to make this all work - e.g. on Mac we've been given this hack - https://files.xamarin.com/~jeff/MonoDevelop-c015b551ceb5f43c864b039b0abd487dd46b5dc2.dmg - love it :)

    Sorry - this is so painful. It is a transitional process - the future is portable :)

  • MihaMarkicMihaMarkic SI ✭✭✭✭
    edited March 2013

    Stuart, what branch is v2 (latest stable I presume) - is it vNext?

    Found - yes. Mentioned somewhere in the vNext branch description on GitHub.

  • StuartLodgeStuartLodge USBeta ✭✭✭

    @MihaMarkic Yes, currently:

    • master is v1
    • vNext is v2
    • vNextDialog needs to be removed (will add to my todo list)
    • v3 is work in progress for v3

    There are some binaries available on SkyDrive - see the binaries link on the right of http://slodge.blogspot.com

    The code is stable on Xamarin 1.0 . For XamDroid it also seems good on Xamarin 2.0. For Xamios ... some people seem to be running OK, others not so OK.

    For all platforms, the special MonoDevelop/XamStudio builds from @jstedfast are brilliant - help a lot with easing setup :)

    Getting the Mvx source and binary process into a cleaner state is high in the priority list for v3 - but it's a shifting target with platform changes, PCL changes, await/async, etc - so I do expect to still keep working at it :) I have customers who want me to keep the VSMonoTouch code alive because of where they are in their dev (and budget) cycles. Supporting 5 different target operating systems and multiple Xam and MS product releases simultaneously makes me feel a bit dizzy even with the help of PCLs ;)


  • MihaMarkicMihaMarkic SI ✭✭✭✭

    I somehow don't want to mess with PCL at this time (having Xamarin Studio installed). I am considering an automated process that would copy/modify csproj files to have Android projects instead (I am not interested in iOS, just Android and Windows) - for the time being.
    Shame that Xamarin doesn't support PCLs officially yet...

  • StuartLodgeStuartLodge USBeta ✭✭✭

    Sounds like an interesting plan :) Probably something I should have done last Summer - but I opted for the 'Stampy' route instead - opted to keep bashing my head against and eventually through the wall instead.

    For Android only, I think PCLs pretty much just work in VS and in XamStudio 2.0 on the Mac (with @jstedfast patch applied)

  • MihaMarkicMihaMarkic SI ✭✭✭✭

    "For Android only, I think PCLs pretty much just work in VS

    I'll see, but first I have to get my activation back :-S still waiting for activation fix ..

  • MihaMarkicMihaMarkic SI ✭✭✭✭

    Indeed it opens and compiles (v3 is still a bit chaotic solution, I need to fix it a bit).
    It looks like just referencing a PCL assembly from within VS is a problem. I mean if I manually edit csproj it works just fine.
    That said I am almost compiling the Tutorial.Droid - just a problem with newtonsoft.json remaining.

  • MihaMarkicMihaMarkic SI ✭✭✭✭

    Stuart, does debugger stops on breakpoints within PCL sources? Mine doesn't, it stops for Android sources though.

  • StuartLodgeStuartLodge USBeta ✭✭✭

    There are people you can lobby... both on the inside and outside of Xamarin. I hate to say it, but so far making noise seems to be more effective than not...

    Meanwhile, if anyone's interested then I've got the v3 code building on VS and XS... so next up is QA and documentation... more details on: http://slodge.blogspot.co.uk/2013/03/v3-code-reaches-alpha.html

    Will spend a lot of time on this next week!

  • StuartLodgeStuartLodge USBeta ✭✭✭

    V3 binaries are now being pushed to https://github.com/slodge/MvvmCross-Binaries

    I'm working on docs on the v3 pages on https://github.com/slodge/MvvmCross/wiki/_pages - this list will hopefully grow a lot v soon.

  • ChWoChWo DEMember

    Thanks @StuartLodge!

    I'm a bit confused about the actual situation.

    The v3 binaries are still alpha, aren't they?
    Should vNext users upgrade to v3 or is it better to wait a few weeks/months?

    After upgrading to v3 existing solutions may not work anymore due to a new ViewModel lifecycle . Can I make vNext solutions work with v3 when I use the old ViewModelLocator and register it as described on StackOverflow?

    You're talking about PCL issues using Xam.iOS inside VS2012. So is it possible to build PCLs against Xam.iOS from inside VS2012?

  • ChWoChWo DEMember

    Thanks, I think I will stay on the old tools and vNext for a while.

  • StuartLodgeStuartLodge USBeta ✭✭✭

    I'm planning on shifting v3 to Beta on Wednesday this week.

    After it's shifted to Beta then it will be a lot harder to change patterns, APIs, namespaces, etc - I'll be self-enforcing some 'stability'

    So if anyone has any HotTuna requests... then get them in today or tomorrow :)

  • jrimjrim USMember
    edited March 2013

    Ok, I am confused. Just to clarify... The Xamarin download link has clear advertisements that say:

    • Android - Develop native Android apps
    • iOS - Develop native iOS apps

    from http://xamarin.com/download

    Is it actually possible to do iOS/Android cross-platform development with Xamarin out of the box, or are there hacks and other adjustments required? I've been reading through MvvmCross for the last hour or so, sorting through all of the fragmentation and disorganization, and it's difficult to grasp a status quo. I don't want to pay $299 for their tool if it requires hacks and isn't really supported! I also don't exactly understand if I even need Xamarin, or if I can just use my current developer environment (Visual Studio 2010) for Android/iPhone cross-dev using MonoCross.

    To that end, does vNext/v3 support iPhone+Android integration out of the box, without having access to a Mac? I thought I read in another thread someone referencing needing a Mac to support iOS/iPhone cross-development.

    By the way Stuart, let me give an enormous KUDOS to you for your excellent support habits and efforts. It is rare to find someone demonstrating so much accountability for their open source projects. You are a true idol for the open source movement, or I suppose just for online communication habits in general!

  • StuartLodgeStuartLodge USBeta ✭✭✭

    Thanks Jordan

    Is it actually possible to do iOS/Android cross-platform development with Xamarin out of the box


    But if you had asked:

    Is is possible to use PCLs


    For PCLs, you do still need some small 'hacks' but these are fairly small now. Within the next month I hope you won't need them - listen to Miguel speaking recently on Hanselminutes podcast for the reason behind that hope.

    You can develop without PCLs and the path that way isn't that painful.

    without having access to a Mac?

    Doing any iPhone development without access to a Mac is not worthwhile IMHO - Apple make it hard - you are welcome to try, but honestly you will burn more money in time than you can save on a $499 Mac Mini (which later will have a resales value of $399)

    For general questions on do you need Xamarin... yes, you need their license - which means:

    • $299 per product if you use XS
    • $999 per product if you use VS

    Don't bother starting on the free version - it's too small to do anything - so start with a 1 month trial instead.


    Also relies on having a Mac and Xamarin

    Honestly, if you want advice about how to get started, I'm the wrong person to give advice - others here have gone through the pain&pleasure much more recently than me.

    However, if you are a c# coder, I think you'll find you get going very quickly. If you read through http://www.codeproject.com/Articles/566191/MvvmCross-v3-Writing-a-First-App you'll get the idea for MvvmCross.

    I am working on more docs and getting started soon - but I am holding off from documenting some of the current hacks - especially as they will change any day now...


  • jrimjrim USMember

    Very informative and concise response, thanks Stuart! I am indeed proficient with C#. Looks like I'll be borrowing a friend's Mac for a bit, then. Nice CodeProject article, I saw you post that same first page elsewhere (on your blog?) as you were making progress. Glad to see it finished!

    I understand you are in a tight spot to be updating documentation considering dependencies change often. Hopefully something more well-put together evolves as the products themselves evolve!

  • RobertSalitaRobertSalita USMember ✭✭

    Regarding the codeproject article, I've posted some questions at the bottom of the article's page. When you have a moment (ha, ha), I think the community would be interested in an answer.

  • StuartLodgeStuartLodge USBeta ✭✭✭

    Just looked at the first page, the last page and a couple of random pages. Couldn't spot the question - gave up.

  • RobertSalitaRobertSalita USMember ✭✭

    @StuartLodge The problem is you are too prolific. I thought there was just one recent article but you actually created two. Here's the one with my comments:


  • StuartLodgeStuartLodge USBeta ✭✭✭

    Have answered there.

    For questions about the Xamarin designers, I think you are much better off asking questions on a thread here.

    I would love to see the Android designer include a binding field - or to have an API so that I can add the binding field. But I don't think it's high on the Xam list right now...

  • StuartLodgeStuartLodge USBeta ✭✭✭

    OK... still no luck here with getting iOS to play from VS... but I'm moving Mvx v3 on to Beta - including some Nuget action :)



    Forwards :)

  • RobertSalitaRobertSalita USMember ✭✭

    Watched the hot tuna video. There's lots to digest. Looks like there's several meals worth.

    I have a couple questions about low priority (for me) features. I'm trying to ascertain the scope of MvvmCross. I can't ask better questions because I haven't experienced that gestalt/Eureka! moment yet. What additional platforms will be supported -- Mac OS X? Anything else? I saw a Telerik folder during the demo. Is that a possible platform in some way? Is javascript/html5 out of the scope of Mvvmcross?

  • RobertSalitaRobertSalita USMember ✭✭

    More feedback on video.

    1. I'm not familiar with Resharper so any usage of it added a bit of confusion.

    2. I was surprised by the To Do steps. Seems like most can be eliminated by proper Visual Studio templates. Seems like all can be eliminated by a Visual Studio wizard.

    3. Sorry, noobie questions: Why are MvvmCross plugins necessary? Doesn't Xamarin provide a similar cross-platform framework? Why are there so many plugins? Can't they be consolidated?

  • StuartLodgeStuartLodge USBeta ✭✭✭

    1 as Seb once said, "if you're a consutant and you don't use r#er, then you're stealing from your customers" :)

    2 yes, other ways can be done. I'll ship other ways. Other people are welcome to ship them too :) choice is good

    3 no, xamarin have not yet ever shipped a single pcl. Even when they do 'see the light' then a wise man once said 'choice is good' ;) there are many plugins already. There will be many many more. Shipping small individual components is imo more flexible and 'agile' than shipping on big fat monster. With nuget, it's possible to build combo packs using dependencies. people can and should have other opinions. Choice is good :)

  • RobertSalitaRobertSalita USMember ✭✭

    Like me, MvvmCross is a work in progress :)

Sign In or Register to comment.