Quantcast
Channel: //InterKnowlogy/ Blogs » Silverlight
Viewing all articles
Browse latest Browse all 10

Make Portable Libraries Your Go-To Project Template

0
0

With the upcoming release of Visual Studio 2012, Portable Libraries will finally be built into the product. The 2012 iteration of Portable Libraries is much improved from the prior versions, adding not only new platforms (Windows 8 Metro) but greatly increasing the list of available framework library classes that can be used across the various platforms.

For those not familiar with Portable Libraries, they are a variant of the standard Class Library VS project type which allows targeting multiple platform versions of the .NET CLR with a single project that compiles to a single common DLL. In 2012 the available platforms are:

  • Full .NET Framework 4.0+
  • Silverlight 4, 5
  • Windows Phone 7+
  • Windows 8 Metro
  • Xbox (very limited)

Thanks to some reorganization done in the framework itself, including the .NET 4.0.3 update, the common subset of framework functionality across the four primary platforms should now be sufficient for writing a large part of the code for many business applications. In particular, things like entity objects, data access (WCF HTTP client), and even ViewModels for MVVM can now be written in portable libraries and used across any of the supported platforms without any extra compatibility work needed. There are still some restrictions on what you can use (much like in .NET Client Profile) and a few slight API differences from what shows up in other platforms, but for the most part the code ends up looking just like a Class Library in any one of the platforms. Thanks to the magic of the internal organization of the framework, each supported platform can use the resulting DLL and run it as though it were a platform specific assembly, even when underlying framework code is in different assemblies across the various platforms.

Even if you have no immediate need for multiple platforms, starting out with a Portable Library instead of a standard Class Library can help extend the life of your code and save a lot of work in the future. Imagine being able to create a fully functional Metro version of your application a year or two down the road by just layering a new (also XAML) UI design on top of the code originally written for the WPF or Silverlight, without needing to modify a single line of that underlying code to make it compatible. Now imagine that you didn’t use Portable Libraries and you now need to comb through your entire codebase to extract all of the platform specific code before you can even start setting up projects to share across your applications. Now which codebase do you want to leave to your maintenance programmers?


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images