DarksideCookie

Come to the dark side...we have cookies!

Sample code from my LEAP presentation about cross-framework code sharing

Yesterday I was invited to speak in front of a bunch of really sharp guys attending the Lead Enterprise Architecture Program, LEAP, at Microsoft here in Stockholm. The topic of the day was how to share code between projects targeting multiple frameworks/platforms. Basically “how can we share code between projects aimed at WP7, Windows 8, Silverlight and WPF” in a useful way, limiting the duplication of code as well as maintenance.

Most of my presentation revolved around a sample I had written to target all platforms. It is a very simple application, but still shows that it is very possible to get it to work.

However, I still say that you should take a long hard look before you do it. As the different platforms/frameworks target different devices with different form-factors and different usage, sharing code and producing the same functionality across the board might not be the best solution. In some cases it will, in some cases it won’t. But if you end up hindered and limited by having to get the code to work on all platforms, I suggest considering breaking it apart…but that’s me…

The solution consists of 2 VS solutions. The first one targets Windows 8 and VS11. It contains the code that is shared, as well as server and clients for Silverlight, WPF and Metro. It can be downloaded here: LEAP.Demo VS11.zip (6.67 mb). Sorry about the huge download, but the NuGet stuff is making it big.

The second part works in VS2010 on Windows 7, and targets WP7. It doesn’t actually contain the shared code and code for the service, instead it just contains the assemblies. It is available here LEAP.Demo WP7.zip (512.89 kb).

Go ahead and have a play with it, and don’t hesitate to drop me a line or a tweet if you have any questions…

DISCLAIMER: The code was built in a very quick manner and has very little testing. It goes under the “works on my machine” license, which basically gives you no guarantee, but will on the other hand not limit you in any way. Smile

Cheers!

Posted: May 04 2012, 09:11 by ZeroKoll | Comments (2) |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Manage post: :)

Comments (2) -

Cristian Sweden said:

Yeah version numbers are hard to get right..
Visual studio 2011?

# May 04 2012, 09:46

ZeroKoll Sweden said:

Sorry...fixed!

# May 05 2012, 20:35

Add comment




  Country flag
biuquote
Loading