Pages

Tuesday, February 2, 2010

Dealing With the Removal of the ASP.NET Silverlight Server Controls in Silverlight 3

Silverlight 3 has been out for some time now, and most Microsoft sites you may visit often (including Microsoft Update) will prompt you to do the install. If you did the install and removed all of Silverlight 2 including the SDK as required to run the full Silverlight 3 SDK, then you may have notices a few things break in your existing Silverlight 2 applications or controls.

This is because with the advent of Silverlight 3, the convienient ASP.NET Silverlight server controls were removed. The solution is to use the more generic <object> tag to reference controls and pass parameters. While I understand the premise behind this and have seen quite a lot of documentation, I have not see a lot of thorough examples on a 1:1 conversion. In fact in some instances I read where the <asp:mediaplayer> tag was used, that the .js encapsulated behind that would now have to be incorporated into your control. The suggestion was to use Blend with Encoder to make this easier by using one of their templates, and then exporting a .xap file.

I think the easier conversion will be for those that used just the <asp:silverlight> tag to reference a .xap control. In this case you could probably easily convert the code to using the <object> tag and pass in any needed parameters. However, I think converting the <asp:mediaplayer> references are going to involve more work.

If you are looking for the fastest solution to fix your current application so that it will work, to buy time to make the full conversions to SL3 (or maybe wait until SL4 is RTM, because my experience is each SL release has had major changes that don't upgrade so well; that's ok though - the growing pains come with the territory of new technology) then here it is. You need to go to the /bin of a currently deployed solution and try to find the following .dll: System.Web.Silverlight This .dll has the asp.net Silverlight Server controls. If you copy that .dll into a 'Components' directory of sorts (or into the /bin, however your process dictates) and add a reference to that .dll, your errors should go away. If you do not have a copy of the .dll anymore, you can download the Silverlight 2 SDK and get the .dll from there as well.

For a more detailed reference on ensuring your Silverlight 2 application work with Silverlight 3, check out the following link:
Ensuring That Your Silverlight 2 Applications Work with Silverlight 3

For a more detailed reference on persisting the Silverlight 2 ASP.NET server controls, take a look to the following whitepaper:
ASP.NET Server Controls for Silverlight in the Silverlight 3 SDK

One of the better references I have seen for parameters that can be passed to an <objectgt; tag:
Silverlight 3 object tag param list

0 comments:

Post a Comment