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.
Step 2: You can add the following code at MainPage.xaml
for testing if you are new with Silverlight
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
Create a Empty SharePoint Project to deploy in SharePoint
Step 4: To Deploy Application in SharePoint
- Create Empty SharePoint Project (Run As Administrator)
- 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.)
- Set SharePoint Site URL where you want to deploy
- Add a new Module to the project
- Open the Elements.xml file and Edit the file to include the xap file that will be generated from the Silverlight application
- 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
Click Add and in the Silverlight Web Part dialog enter the value from the Url field in the Elements.xml file
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.
Now Your Silverlight application Deployment Done!
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