Search code examples
.netsilverlight.net-4.0assembliescil

Is there any way to consume .NET 4.0 assemblies in Silverlight


Silverlight can only recognize its v2.0.5.0 assemblies. The way to consume .NET 2.x/3.x assemblies in Silverlight truly exists. If I want to call, such as the method of Json class provided by System.Runtime.Serialization assembly, which is just in .NET 4.0, not in Silverlight v2.0.5.0, what can I do? Can I only consume the class and method in .NET 4.0 assemblies which can only be found in Silverlight v2.0.5.0 assemblies at the same time?

Another case is that some http classes and methods are in System.Web assembly in .NET 4.0 and also only in System.ServiceModel assembly in Silverlight v2.0.5.0. Should I do as the following way to consume these classes and methods in .NET 4.0

  1. ILDasm xxx.dll /out:xxx.il
  2. change sth in the IL file(how to do it???)
  3. ilasm xxx.il /dll /resource:xxx.res /out:xxxx.dll

Solution

  • No, you cannot access .NET 4 assemblies this way.

    The ILDASM hack you list isn't going to work: System.Web is a very complex system, and it has dependencies on other parts of the framework.