Click here to Skip to main content
Licence CPOL
First Posted 12 Jan 2012
Views 13,961
Bookmarked 10 times

Silverlight Web Part sandboxed Deployment in SharePoint 2010 using VS2010

By | 18 Feb 2012 | Article
How to deploy Silverlight Web Part in SharePoint 2010 using VS2010

Introduction

Silverlight can be used to integrate rich, powerful applications into SharePoint at the Web part level of integration. It can live just about anywhere in the user interface With SharePoint 2010. My example will be geared toward how simple it is to publish a Silverlight application to a SharePoint site and use it in a web part.

Background

It was my client requirement to deliver our Silverlight Application in SharePoint Site and continuous development and deployment.

Getting start with a Silverlight application using VS2010

Step 1: Open Visual Studio 2010 and create a new Silverlight Application


Uncheck the checkbox [ ] “Host the Silverlight application in a new Web site”. We don’t need to host Silverlight in a separate web app since SharePoint will be the host.

Picture2.png

Step 2: You can add the following code at MainPage.xaml for testing if you are new with Silverlight

Picture3.png

Build the Application and your Silverlight Application is ready at this stage

Step 3: So, Develop your Silverlight application as per as your requirement. For Example: I developed a application like below. Let’s imagine this application is ready to deploy

Picture4.png


Create a Empty SharePoint Project to deploy in SharePoint

Step 4: To Deploy Application in SharePoint

  1. Create Empty SharePoint Project (Run As Administrator) Picture5.png
  2. Leave the sandboxed solution checked and click ok (Pop-up will ask you to choose to deploy as a sandboxed solution or a farm solution.)
  3. Set SharePoint Site URL where you want to deployPicture6.png
  4. Add a new Module to the project
    Picture7.png
  5. Open the Elements.xml file and Edit the file to include the xap file that will be generated from the Silverlight application
    Picture8.png
  6. Now your application is ready to be deployed. Right click the SharePoint project and select Set as Startup Project and Deploy Solution.

Add Silverlight Web Part in SharePoint Site

Step 5: On the SharePoint site click the edit icon then the insert tab, select Web Part, and choose the Silverlight Web Part in the Media and Content category

Picture9.png

Click Add and in the Silverlight Web Part dialog enter the value from the Url field in the Elements.xml file

Picture10.png

Configure Web Part to adjust size.The problem is the default size for the Silverlight Web Part is 400x300 but the application is bigger than 300.

Picture11.png

Now Your Silverlight application Deployment Done!

Picture12.png

Happy SharePointing!!

Points of Interest

Sometimes Deploy Solution may get when it try to retract old solution. Just try to re-deploy again should solve the problem :).

History

Last Update 13 Jan 2010

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

MJ Ferdous

Architect
Congral LLC
Bangladesh Bangladesh

Member

MJ Ferdous is an IT professional from 8 years ago.
 
He is working as Technical Project Manager of Congral LLC, USA and SharePoint Consultant as well. He has industry level experience on SharePoint and did lots of Presentation & workshop on SharePoint.
 
Before join in Congral, he did work in OT Group SPA, Italy as SharePoint Consultant, Rockwell Automation-Italy as Project Engineer and many others .net companies. He did work on many international projects during his professional life. The major projects are included below:
Shared Care Plan for Congral LLC, USA
Internet Banking Portal for BANCA CREDEM, Italy
MES solution for Rockwell Automation, Italy
Tourism for Travel Curve Inc., USA
and so on...
 
He is the author of several technical articles. More Than 50 articles are published in mrbool.com as Technical Author of that site. He is also owner & moderator of several groups of SharePoint and asp.net.
 
Looking for a Offshore Development or partnership.............. in any development in Dot.Net & Sharepoint 2007,2010 Platform.
 
Search him in google by 'MJ Ferdous' to get all links, articles, profile etc
Contact him: ferdous_cs [at] yahoo.com
His blog: http://geekswithblogs.net/ferdous
His personal site: http://mjferdous.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionExcellent tutorial Pinmemberelun9:14 28 Mar '12  
AnswerRe: Excellent tutorial PinmemberMJ Ferdous9:35 28 Mar '12  
GeneralMy vote of 5 PinmemberMd. Rashim uddin23:43 12 Jan '12  
GeneralRe: My vote of 5 PinmemberMJ Ferdous19:51 6 Feb '12  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 18 Feb 2012
Article Copyright 2012 by MJ Ferdous
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid