Sharepoint Small Steps – Silverlight
I spent yesterday looking at the use of Silverlight in Sharepoint without too much success.
I got cracking on my WSS VPC and started by building a simple Silverlight app using VS2008. The Silverlight app template will build either a web site or a single html page which hosts your Silverlight app. This all went well and my "Hello Silverlight World" app was soon up and running.
Looking to get this into Sharepoint I opened the November issue of MSDN which has an article "Light Up Sharepoint With Silverlight 2 Web Parts" and read through the steps. The 1st thing I noticed was that the artcle was writte with Silverlight Beta 2 and I have the RTM version. Anyway, the technique is to host your Silverlight app in a web part and add the web part to the SP site. In VS2008 I created a web part and implemented the 2 methods (OnLoad & CreateChildControls) needed to load the Silverlight app. I built the web part and deployed it to my SP site (via the debug setting on the web part project). I copied the .xap (Silverlight app) to a newly created ClientBin/XAP directory under the SP virtual directory.
In to my SP site and I edited my web page, adding my new web part to the page. The Silverlight app was not displayed in my web part. Hhhmmm. I checked the application log and web site logs for ny clue – nothing. I attached VS2008 to the SP web (I used iisapp to find exactly which process was hosting SP), added a breakpoint on the OnLoad event of my web part and refreshed the page. Both, the OnLoad and CreateChildControls methods were executed without issue but still no Silverlight app.
Another review of the magazine article showed that there were some web.config changes to make relating to Silverlight and I cracked on and made the changes. I restarted IIS (not strictly neccessary but I like to be sure), refreshed the page – still no Silverlight.
I read blog after blog about this and discovered that there are differing thoughts around what needs to be done to get Slverlight deployed and I tried them all – the majority of blogs are still relating to Silverlight Beta 2 not the RTM version. I visited the MSDN labs section and took part in a lab session for integrating SP and Silverlight and I managed to deploy a Silverlight app no bother. I looked in the web.config for the SP site and didn’t see the changes that the MSDN article recommended.
I returned back to my VPC and accessed the Silverlight streaming service from Microsoft. I created an account, created a simple app and copied the provided HTML into a web content web part on my page. Result – the Silverlight app was displayed in SP! I reckon that this means that Silverlight is not installed/configured correctly and I’m prearing myself to painstakingly check that all of the required code is in place on my VPC……
Leave a Reply