[mono-android] [MonoTouch] sharing code between mono touch and mono for android

Stuart Lodge me at slodge.com
Mon Feb 27 14:26:35 UTC 2012


I'm with you on some of the refactoring pain thing.

I'm work 95% of the time in VS2010 using your plugin to make R# do
something. I'm currently sharing as much code as I possibly across all 3
platforms by trying to use mvvm with all viewmodels, models, etc in a
"shared project".

I generally don't use #if/#endif if I can avoid it... I've got an IoC
framework setup for most platform specific things.

To resync the file and folder lists across the separate droid, ios and wp7
projects I just cut and paste the folders in VS2010 - that works quite well.

To rename (using R#) I generally just use R# for WP7 code and then manually
do the changes in the other UI projects - not ideal, but it doesn't take
that long (and it encourages me to use as much shared code as possible)

One other point of pain - I do find VS2010 and MonoDevelop do some "odd
things" to the Touch solution and/or project files which means that
sometimes I just can't get my library projects to load into MonoDevelop
(still investigating what on earth this is).

I don't really see the value of the shared code approach being that high in
the initial build time - it's in maintenance, reuse of existing code and
later reuse of the output code that I really hope to see the benefits.

Stuart

2012/2/27 Jamie Briant <monotouch.list at binaryfinery.com>

> 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> wrote:
>
>>  Good morning
>>
>> On 2012.01.31 01: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://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
>> w: http://www.holisticware.net
>>
>>
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
>>
>>
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120227/330b145b/attachment.html>


More information about the Monodroid mailing list