[mono-android] [MonoTouch] sharing code between mono touch and mono for android
Alec Tucker
ATucker at whiteclarkegroup.com
Mon Feb 27 23:07:26 UTC 2012
Jamie,
While you're waiting for the book to arrive...take a look at:
https://github.com/follesoe/FlightsNorway
for a neatly worked and well explained example. I've been using this approach successfully for some time now across all three platforms.
Feel free to get in touch if you want some more pointers.
Alec
From: monodroid-bounces at lists.ximian.com [mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Nathan Clevenger
Sent: Tuesday, 28 February 2012 4:25 AM
To: Discussions related to Mono for Android; monotouch at lists.ximian.com
Subject: Re: [mono-android] [MonoTouch] sharing code between mono touch and mono for android
Have you looked at the proposed solution/project structure and workflow proposed in the new book, Professional Cross-Platform Mobile Development in C#?
http://www.amazon.com/Professional-Cross-Platform-Mobile-Development-C/dp/1118157702/ref=pd_sim_b_34
This is the approach that our firm has structured and managed 100+ cross-platform mono-based projects, and while it's not without its idiosyncrasies, it does work quite well.
Thanks,
Nathan
From: monodroid-bounces at lists.ximian.com<mailto:monodroid-bounces at lists.ximian.com> [mailto:monodroid-bounces at lists.ximian.com<mailto:monodroid-bounces at lists.ximian.com>] On Behalf Of Jamie Briant
Sent: Monday, February 27, 2012 7:13 AM
To: monotouch at lists.ximian.com<mailto:monotouch at lists.ximian.com>; monodroid at lists.ximian.com<mailto:monodroid at lists.ximian.com>
Subject: Re: [mono-android] [MonoTouch] sharing code between mono touch and mono for android
Is this as good as it gets? I'm attempting to build an MfA version of my MT app and its proving extremely frustrating, to the extent that I'm considering just writing the thing in Java. My reason for using MT was the awfulness of Objective-C, and while java is frustrating its entirely doable. The only thing at this point is the real possibility that a WP7 version will be next, so I might as well bite the bullet now.
Context: I'm using Visual Studio, Resharper, and my own Monotouch VSIX to load MT projects. I edit entirely in VS, and build in MD on the mac. I've tried Project Linker.
Problem: MfA, MT and WP7 require different .XXproj file formats.
There's no getting around this for WP7.
Why is this a problem?
1. "This file is open in another project". (and associated Intellisense death)
2. Refactorings don't refactor #if/#endif code.
3. Refactorings don't refactor code in linked projects at all.
4. Resharper completely horked.
Basically, I cannot work the way I work. And if I can't do that - if I can't keep the apps in sync as I work I might as well use java: if I have to retype the code I can just as easily convert it to java as I type.
Project Linker doesn't solve any of these. It makes things slightly less broken, but the flip side is I managed to delete a whole ton of files off disk as I tried to remove them from the MfA project.
Source Control as an alternative. I thought about having separate branches and handling it that way. But this fundamentally fails for refactoring often. It made me wonder how on earth teams of programmers collaborate. When I decide to take a class, split it into two and then pull out a common base, all with new names: how does a team deal with that? I refactor continuously.
A Possible Solution
Could the MT and MfA compilers/linkers/projects be made to accept WP7 projects as References? Then I could factor out common code into a shared library - but it would claim to be WP7 so the WP7 app could use it. The MT and MfA apps would ignore the fact that the library is WP7. MT could solve any problems at code generation time anyway.
Pain
How do the rest of you do this? Is Project Linker as good as it gets? How do you deal with intellisense/resharper being completely horked?
Thanks,
jamie
On Mon, Jan 30, 2012 at 11:30 PM, Miljenko Cvjetko <mcvjetko at holisticware.net<mailto:mcvjetko at holisticware.net>> wrote:
Good morning
On 2012.01.31 01<tel:2012.01.31%2001>:59, Felix Collins wrote:
What is Project Linker?
Byproduct of Patterns and Practices project called Prism where MS guys explain
code sharing on WPF, SL and lately WP7 platform.
Project linker is just a tool VS plugin that helps batch linking of files. Defines
project dependencies in sense of code sharing (copy as link + paste or copy + paste as link)
some refs:
http://msdn.microsoft.com/en-us/library/ff921108(v=pandp.20).aspx<http://msdn.microsoft.com/en-us/library/ff921108%28v=pandp.20%29.aspx>
http://visualstudiogallery.msdn.microsoft.com/5e730577-d11c-4f2e-8e2b-cbb87f76c044
Greg's sample with M4A
http://www.gregshackles.com/2010/12/shared-libraries-for-windows-phone-7-monodroid-and-beyond/
I like the tool, cos it is nonintrusive regarding IDE tools, does not break VS (other plugins) and
works with MonoDevelop too (meaning one can do the linking in VS and all links are picked up).
Right now besides integrating MTch stuff I'm trying to extend our MultiTarget solution template to
include Project Linker stuff from the beginning, so the manual addition of links is not necessary.
HTH
regards
mel
On 31/01/2012 12:46 p.m., Miljenko Cvjetko wrote:
Sharing code with Project Linker
--
Miljenko Cvjetko dipl.ing. ET
Direktor/CEO
Projektant rješenja/Solution Architect
Razvojni programer/Senior developer
Voditelj projekta/Project Manager
IX južna obala 13
Kajzerica Zagreb
T: 385 1 7775555
M: 385 91 557 447 3
F: 385 1 7779556
e: mcvjetko at holisticware.net<mailto:mcvjetko at holisticware.net>
w: http://www.holisticware.net
_______________________________________________
MonoTouch mailing list
MonoTouch at lists.ximian.com<mailto:MonoTouch at lists.ximian.com>
http://lists.ximian.com/mailman/listinfo/monotouch
This message was scanned at Monday, February 27, 2012 5:25:41 PM GMT by Trend Micro IMHS on behalf of White Clarke Group
This message was scanned at Monday, February 27, 2012 11:07:33 PM GMT by Trend Micro IMHS on behalf of
White Clarke Group - www.whiteclarkegroup.com.
White Clarke Group Ltd - Registered in England - Registered number 03435619.
Registered address: Fairfax House, 15 Fulwood Place, London, WC1V 6AY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120228/bb4e7075/attachment-0001.html>
More information about the Monodroid
mailing list