Friday, March 20, 2009

SharePoint Development with Silverlight 2.0

There are currently three modifications to make to your SharePoint environment for hosting Silverlight 2.0. First install the Silverlight runtime from http://silverlight.net/GetStarted/. Then...

  1. Add a MIME type for Silverlight. I'm running my SharePoint farm on Windows Server 2003 (these instructions are a little different for Windows Server 2008). On the SharePoint server open IIS, right-click the server node and select Properties. Click the "MIME Types..." button. Click the "New..." button and add a MIME type. Extension: .xap (include the dot ".") MIME Type: application/x-silverlight-2.

  2. Add System.Web.Silverlight.dll to the GAC. I found System.Web.Silverlight.dll at "C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server\" in my [Windows Server 2003 R2] development environment. So from a command prompt (at "C:\Program Files\Microsoft SDKs\Windows\v6.0a\bin") I entered the command: gacutil -i "C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server\System.Web.Silverlight.dll". Verify the installation by navigating to C:\WINDOWS\assembly (on a Windows 2003 Server OS): System.Web.Silverlight.dll should appear in the list.

  3. Modify the SharePoint web.config file. This file is typically located at C:\Inetpub\wwwroot\wss\VirtualDirectories\80\ but your mileage may vary.

A good article to start with is Light Up SharePoint With Silverlight 2 Web Parts. Be sure to do the above in the order given. For example, step 3 (web.config) relies on System.Web.Silverlight.dll being in the GAC.

No comments: