[mono-android] [MonoTouch] sharing code between mono touch and mono for android
Felix Collins
felix at intranel.com
Tue Feb 28 03:18:00 UTC 2012
The different platforms can be in the same solution except for MonoTouch which can't be compiled on PC. We have out shared app code in three projects named something like MyApp (for a .net/mono console version), MyApp.MD (for android) and MyApp.MT (for ios). These three projects all point at the same files but compile targeting the different platforms. On mac it would be possible to compile all three at once from one solution.
On 28/02/2012 2:53 p.m., James Briant wrote:
> So the book and the FlightsNorway take the approach of putting the platforms in their own solutions. Which means that the benefits of automated refactoring go out the window. The flip-side, I suppose, is that automated refactoring is a great way to screw up version control - so teams >1 person have to tip-toe around that. Which is to say, that if you have a team working on app, or sharing code, you don't lose anything by having multiple solutions as you have to be careful about any refactor causing merge hell anyway. Looks like you guys also have a your own "middleware" approach, and code to this common platform. The platform is used by many projects with many programmers and as such has to be pretty stable anyway.
>
> Is that an accurate assessment?
>
> jamie
>
>
> 2012/2/27 Nathan Clevenger <nathan.clevenger at itr-mobility.com <mailto:nathan.clevenger at itr-mobility.com>>
>
> 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
>
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com <mailto:Monodroid at lists.ximian.com>
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
>
>
> --
>
> jamie briant
>
> founder | binaryfinery | mobile, social, cloud, apps
>
> www.binaryfinery.com <http://www.binaryfinery.com/>| blog.binaryfinery.com <http://blog.binaryfinery.com/> | about jamie <http://careers.stackoverflow.com/jamiebriant>
>
>
>
>
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.1913 / Virus Database: 2114/4835 - Release Date: 02/27/12
>
More information about the Monodroid
mailing list