[mono-android] Sharing code between iOS, Android and Windows Phone

Miljenko Cvjetko mcvjetko at holisticware.net
Mon Nov 7 18:01:21 EST 2011


Hi

On 2011.11.07 08:16, Steven Pack wrote:
> Hi All,
>
> I'm using Xamarin, specifically because I'd like to share as much code 
> as possible between the platforms. I've noticed I can only reference 
> library projects that target "Mono for Android x.x". I'd hoped to be 
> able to simply create a Mono class library and only use the classes 
> supported by MonoDroid or MonoTouch and reference said project from 
> either platform.
Our team does it with single solution and projects for each platform and 
shares on source
code level with links to source files (cs, xaml etc) not IL (by 
referencing assemblies).

Architectural only 2 layers Business Logic BL and Presentation Layer PL with
assemblies per platform... Controlers and ViewModels in MVC and MVVM can be
moved to those assemblies...

  * Business logic (BL) per platform linked with Project Linker.
      o Starting with WP7x project as "smallest common denominator -
        subset"
        (because of various restrictions - Android Mono4Android and iOS
        MonoTouch are still in front).
      o all projects have WP7 project as "linked source project"
        (Project Linker terminology)
        meaning code in them/their folders is just a link to cs file in
        WP7x prj
  * Presentation Layer PL dlls (User Control library project types)
      o our team uses them for reusing
          + some UI code if it can be shared across projects
          + xaml controls (write up is on the way).
      o MonoDroid - does not apply cos layouts from other
        assemblies cannot be used - yet
  * Presentation Layer EXEs - main entry points - per platform
  * Unit testing Projects
      o if Windows Forms BL assembly reuses bunch of WP7x code and adds
        some more, then NUnit test for WF or WPF project will cover a
        lot from
        WP7x and You are not stuck with WP7 based UnitTesting in emulator

These below are our working notes on recommendation for solution and 
project
structure and naming...
Team is still working on it and it is far from stable, but You could get 
the idea...
http://www.holisticware.net/HolisticWare/Know-How/Development/Visual-Studio-Project-Structure.aspx
Numerical stuff is just to have projects ordered in Solution Explorer, 
because with growing
number of platforms and more architectural layers.

Project Linker exclusion
http://www.holisticware.net/HolisticWare/Know-How/Development/visual-studio-project-linker.aspx

... and we are moving our site to new version, so bunch of texts is 
waiting to be published...

HTH

regards

mel


>
> What am I missing here? How does one go about sharing code?
>
> Steve
>
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid


-- 
Miljenko Cvjetko dipl.ing. ET
	Direktor/CEO
	Projektant rjes(enja/Solution Architect	
	Razvojni programer/Senior developer
	Voditelj projekta/Project Manager

IX juz(na obala 13
Kajzerica Zagreb
T: 385 1 7775555
M: 385 91 557 447 3
F: 385 1 7779556
e: mcvjetko at holisticware.net
w: http://www.holisticware.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodroid/attachments/20111108/ecdc9577/attachment.html 


More information about the Monodroid mailing list