BT

Cross Platform Libraries in .NET/Mono

by Jonathan Allen on May 10, 2011 |

In an attempt to address the platform divergence problem in the .NET/Mono ecosystem, Microsoft is working on an extension called Portable Library Tools. This tool allows the same compiled library to run on .NET 4.0, Silverlight, Xbox 360, and Windows Phone 7 are available. Microsoft is working with Mono to add support for MonoTouch and MonoDroid.

When a new “portable class library” is created the developer needs to choose which frameworks the library needs to run on. Once this is done, only APIs that are available on all of the selected platforms are available. The list of specific classes and methods available can be seen in Visual Studio’s Object Browser.

The Portable Library Toolkit requires projects reference a special set of libraries instead of the normal platform-specific ones. The list of supported APIs by platform and the API changes are available on MSDN. Not shown are the MonoDroid and MonoTouch APIs, which according to David M. Kean will be supported in the future.

Not all .NET/Mono platforms will be supported by this tool. For example, “there are no plans to add support for .NET Compact (prior to Windows Phone & Xbox) or .NET Micro frameworks. “ Nor will there be support for older versions of the full .NET framework, as that would require significant changes to the runtime.

A serious limitation of this tool is the fact that you really are limited to APIs that are available across all of the platforms you selected. This means you don’t have the option to selectively enable features using compiler constants like you would if you created separate DLLs for each target platform. Microsoft is looking into adding the ability to "light-up" additional features using reflection and late binding, but there are no definite plans as of yet.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT