Creating SharePoint 2010 Solutions for Silverlight Applications

by Scosby Tuesday, March 9, 2010

The goal of this post is to explain the process of creating a SharePoint Solution that deploys a Silverlight application. At the time this post was written, I was using Visual Studio 2010 RC and MSS 2010 "beta 2".

There are two primary benefits for using the SharePoint Solution. First, we can initially develop the SL application using our SharePoint Solution and then have an easier transition to production. Last, but not least, we can have our SL app compiled and added to the SharePoint Solution during the build process. This is probably the most beneficial reason for using this technique. Admittedly, there are other ways of deploying your SL app but this one makes a lot of sense when you consider that you'll probably want to have a custom Site Definition for hosting your SL app anyways. But enough background information already, on with the show!

  1. Create a new site definition project, even if you’re not creating a site definition. This creates the special “Site Definition” folder that you cannot add later. So it’s better to have it and not use it, than to need it and not have it.

  2. Enter your development machine’s url

  3. Close the newly created onet.xml file for the site definition. Unless, of course, you are creating a new site definition.
  4. Set your new SharePoint Solution as the Startup Project.
  5. Add your Silverlight Application to your solution.
  6. In order to dynamically compile the Silverlight Application project’s output into our SharePoint solution, we need to use a Module. Add a new module to the project.

  7. Close the newly created Elements.xml file and then delete the Sample.txt file underneath your module.
  8. Click on the Module in Solution Explorer. Open the Project Output References property window.


    You should see a screen similar to the following:

  9. Click add and then change the Deployment Type to TemplateFile. Choose your Silverlight project in the Project Name property drop down. Next, expand the Deployment Location property and then change the Path to whatever location you want. See Developing SharePoint solutions for a more comprehensive chart of the Deployment Type file locations.

  10. A Module is deployed with a Feature. If you have not already defined one, a default Feature will be created to host the module.
  11. Press F5 to deploy the solution and begin debugging.

Tags: , , ,

IT | Programming

blog comments powered by Disqus