[MonoTouch] Best practice for leveraging existing C# library projects

Nic Wise nicw at fastchicken.co.nz
Tue Dec 6 04:53:42 EST 2011


You can reuse the code, but you may need to have more than one .csproj
file - one for MT, one for 4.0 etc.

This is normal for crossplatform, eg:

https://github.com/restsharp/RestSharp

On Tue, Dec 6, 2011 at 03:18, jlindborg <jlindborg2000 at gmail.com> wrote:
> So my rookie adventures continue…
>
> I have a large collection of C# library code for interacting with various
> servers (SOAP/REST/weird proprietary HTML/XML protocols you don’t want to
> know about) – I’d hoped since these are all strictly C# libraries with no UI
> elements and most are in 2.0 (some 3.5) that I could just import the
> projects from my snappy “Common” source folder where they sit and I could
> include them in my MonoTouch solutions all nice and tidy.  Living the
> code-reuse-cross-platform dream.
>
> Apparently that’s not the case.  Unless I’m missing something?  I’ve found
> various posts on forums and FAQ basically saying you need to manually copy
> files from your libraries into new projects – which makes me a little sad
> from an ongoing maintenance standpoint obviously (these libraries are in use
> on other Windows projects after all).
>
> It’s odd because I can bring the project into MonoDevelop’s solution for my
> example iPhone application and it does build (with a few bogus warnings) and
> seems happy, but when I try and import that project as a reference I get the
> dreaded “incompatible target framework” note.  As a test I took the files
> from a library, dumped them directly into my iPhone sample application,
> changed the namespace to match and presto, all worked dandy.
>
> So is there some clean way to approach this without doing some ugly
> copy/past/manual maintenance nightmare?  Since one of the lead off pitches
> for this product is the code reuse story I’d have hoped this was a little
> more slick…
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/Best-practice-for-leveraging-existing-C-library-projects-tp4163295p4163295.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2


More information about the MonoTouch mailing list