Tuesday 11 September 2012

How to debug Silverlight application inside SharePoint ?

How to debug Silverlight application inside SharePoint ?

One can do so by following simple steps given bellow,

  1. Right click on sharepoint project in which you've refferenced silverlight application, It'll display project properties window ,
  2. From that select Sharepoint tab,
  3. Now check Enable Silverlight Debugging option(instead of script debugging) as shown in image bellow,

That's it , now you can add breakpoint on your silverlight application code and start with debbuging.


Use a SharePoint Project to Deploy a Silverlight Application

How to add silverlight application as webpart in sharepoint 2010?

Following is the steps to add silverlight application as a webpart page.
  1. I assume that you've already created a silverlight application, Here I've created application named SampleSilverlight.
  2. Create an Empty sharepoint project by adding new project to solution.
  3. Now Add > New Item > Module and give the name SilverLight.
  4. Delete Sample.txt.
  5. On module right click and go to Properties.
  6. From Properties window select Project Output Refference.
  7. Now add new Refference by clicking on Add button.
  8. Set Deployment property as Element File and give Project Name respectively of your silverlight application.(In my case SampleSilverLight)
  9. Set relevent properties as shown in image bellow set Module URL as shown as well as File URL ,
  10. Now Right Click on Sharepoint Project and Add > New Item > Web parts 
  11. Name it properly.
  12. Delete .cs file from it.
  13. Now double click on .webpart file and set properties as shown in the image bellow,

  14.  Set URL property to relevant path as you have set in step number 9.
    OK that's it you've done with silver-light web part, build your SharePoint project and deploy it.

    You'll see your web part in custom web part groups.