CloudShare: Develop and Deploy SharePoint Solutions From the Cloud to the Cloud – Part II!

In part 1 of this series I wrote about how straightforward it is to develop and deploy SharePoint 2010 or SharePoint Online artifacts through Visual Studio 11 Beta.

You can easily build your solutions in your CloudShare development machine, test against the SharePoint 2010 local installation, and deploy to either a real SharePoint 2010 On-Premise environment or a SharePoint Online instance in Office 365.

In this article, I want to share the goodies that come with Visual Studio 11 Beta that really help to simplify the development and deployment process of your custom SharePoint solutions. I will show you how to develop and deploy Silverlight applications using the new “SharePoint 2010 Silverlight Web Part” project template, available in Visual Studio 11 Beta.

Let’s Begin:

First, you need to access to your CloudShare account and start one of your available environments.

Once you have your environment ready, open Visual Studio 11 Beta. Create a new project by clicking on “File -> New Project”.

In the “New Project” window, go to the SharePoint section under Visual C# project category. Click on the “2010” project templates and the select the new “SharePoint 2010 Silverlight Web Part” project template. Provide a name for the project and the solution and click “Ok”.

In the “SharePoint Customization Wizard” window, specify your local SharePoint 2010 site for testing purposes, leave the deployment type as “Deploy as a sandbox solution” and click “Next”.

The next window in the SharePoint Customization wizards allows you to define the Silverlight Application you are going to create and deploy. Type a name for the Silverlight Application project, the desired programing language (c# in this case), and the Silverlight version to be used (5.0 in this case). To close the wizard, click “Finish.”

Once the project creation process ends, you will see the complete solution structure in Visual Studio 11 Solution Explorer. You will see that the process has created two different projects:

  • A SharePoint 2010 project that will allow deploying the Silverlight Application by means of two SharePoint modules.
  • A Silverlight application project.

You will also see the new Silverlight designer ready for you to begin creating your application using the Silverlight controls available in the designer toolbox.

As an example, simply add a button control to the design surface in the Silverlight designer and configure some of the available properties by means of the “Properties” window.

Add logic to the button in the code behind a file linked to the application. For instance, add a simple MessageBox.Show(“insert message”) call. When finished, simply build the Silverlight Application project.

Before deploying the application to either a real SharePoint 2010 On-premise environment or a SharePoint Online instance in Office 365, let’s inspect the SharePoint 2010 Project in the Visual Studio 11 Beta explorer. As stated before, the SharePoint 2010 Project will allow you to deploy both the Web Part and Silverlight application by means of two “Module” elements:

  • First module will deploy a .webpart file that will allow you to add the Silverlight application in a SharePoint site by means of the related Web Part.
  • Second module will deploy the .xap file containing the Silverlight application created. Note that this module has been configured to read the output of your Silverlight application.
  • Once everything is ready, build the complete solution and prepare to publish the SharePoint one to the cloud. Right click and press the “Publish…” option.
  • In the “Publish” window, specify the Url of the SharePoint Online site and press the “Publish” button.
  • As you are publishing the Web Part to a SharePoint Online site, you’ll be asked to provide your Office 365 credentials.
  • Once you are logged in Office 365, you can see how the Web Part is deployed to the SharePoint Online and the steps followed to accomplish it through the Visual Studio 11 Output window.
  • When the deploying process ends, a browser session will open with the Sandbox solution gallery of the destination SharePoint Online site. There you’ll see your Sandbox solution deployed and ready to be activated.
  • Once you have activated the solution, you’re ready to select and use the Web Part in the package. You’ll find it in the “Custom” category inside the Web Part gallery.
  • You now have your sample Silverlight Application Web Part ready and working on an Office 365 page in SharePoint Online.
And that’s how to use and deploy a Silverlight Application WebPart from the cloud to the cloud by using Visual Studio 11.

Happy CloudSharing!