BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Cross Platform Libraries in .NET/Mono

Cross Platform Libraries in .NET/Mono

This item in japanese

Bookmarks

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.

Rate this Article

Adoption
Style

BT