This is a mirror of official site: http://jasper-net.blogspot.com/

Shared Libraries For Windows Phone 7, MonoDroid and Beyond

| Tuesday, December 28, 2010
  If you’ve been doing mobile development, you probably know all about the problem of having to target multiple platforms, along with the languages each one requires. Having to rewrite and support essentially the same code on different platforms flat out sucks, and isn’t really a great way to spend your time. Thanks to the fine folks working on Mono and its satellite projects, it’s possible to leverage the power of the .NET framework across many platforms. In this article I’ll focus on sharing the same code across Android and Windows Phone 7, but you’ll easily see how it could be extended to Silverlight, ASP.NET or iOS without much effort at all.
These days it seems like the ubiquitous mobile app example is some sort of Twitter client, so why should I be any different? We’ll build a very simple app that let’s you search Twitter for a given term. First, let’s set up the projects we’re going to need in a new solution. This post assumes that you’re using a non-express edition of Visual Studio 2010 since that’s what MonoDroid requires.


Setup
First, make sure you have the Project Linker extension installed in Visual Studio. This extension makes it really easy to share code between projects without having to manually copy code over and maintain changes. You can find it by just searching in Visual Studio’s Extension Manager (Tools -> Extension Manager). Once that’s installed, set up the following projects in a blank solution:

  1. TwitterSearcher: a normal .NET class library
  2. TwitterSearcher.MonoDroid: a MonoDroid class library
  3. TwitterSearcher.WP7: a Windows Phone class library
  4. App.MonoDroid: a MonoDroid application
  5. App.WP7: a Windows Phone 7 Silverlight application

Read more: Greg Shackles

Posted via email from .NET Info

0 comments: