BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Silverlight 4 Brings Assembly Sharing with .NET

| by Jonathan Allen on Dec 03, 2009. Estimated reading time: less than one minute |

Assemblies built in Silverlight 2 and 3 are not binary compatible with the .NET Framework, so if you want to share code you need generally need to dual-compile. With Siverlight 4 and .NET 4, you will be able to use some Silverlight-based assemblies from within .NET 4.

In order to load a Silverlight assembly in .NET, the assembly may only reference the following assemblies:

  • Mscorlib
  • System
  • System.Core
  • System.ComponentModel.Composition
  • Microsoft.VisualBasic

Other assemblies such as System.Xml and System.Net are not currently supported, nor are any of the UI libraries. This means sharing passive data objects is possible but active records that can call services or handle their own XML serialization are out of the question.

One should also note that loading .NET assemblies in Silverlight is explicitly not supported. Since the non-UI parts of Silverlight are a directly subset of .NET, they felt it was less error prone to do it this way than to try to deal with countless missing classes and methods.

If you would like to learn more about assembly portability or want to report an incompatibility between Silverlight and .NET, you can do so on the CLR Team blog.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login 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

Silverlight 2 and 3 assemblies ARE binary compatible by Jason Young

Silverlight 2 and 3 assemblies ARE binary compatible with the .NET framework 3.5, there are a few limitations on which classes can be accessed as explained here blogs.imeta.co.uk/jyoung/archive/2009/07/21/729...

Re: Silverlight 2 and 3 assemblies ARE binary compatible by Jonathan Allen

Seems you are not alone in thinking that. Once I get an answer from Microsoft on this point I'll post a correction.

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

2 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT