This past week I did a session on creating RIA applications in SharePoint at SharePoint Connections in Las Vegas, you know… applications with rounded corners. :) When creating RIA apps for SharePoint, you will eventually come to a fork in the road with a sign that says “how would you like to deploy this?” As usual, the answer is “it depends” but they all boil down to the same final result: the XAP must be in an accessible location.
If the Silverlight application is going to be used across the farm, as in the case of the OOTB site/list/library creation application, it should be deployed to the _layouts directory as you only need one instance on the server. However when building an application that’s going to be used by a single SharePoint site (such as a product browser), I like to create a new library called “Application Gallery” that’s parallel to other system galleries like the Master Page Gallery, Web Part Gallery, Solution Gallery, etc. I then provision the XAP into this library.
One small thing I showed in my session was how to take the output of a Silverlight project (the *.XAP) and automatically include it in your project to provision it into the target site. Most people hadn’t seen this technique and since we were a bit tight on time, I promised them a blog post. So here it goes…
Scenario: You’ve created a new VS2010 solution with a Silverlight project in it (maybe you did/didn’t create the associated Web project for testing… doesn’t matter regardless. Now, I added a new SharePoint 2010 Empty Project to my solution. Next comes the magic…
Add a new Empty SharePoint Project to the solution. To provision a file, you need to use a Module SharePoint Project Item (SPI) template, so add one of these to the project. The next part is where the magic comes into play as it isn’t very obvious. Select the new Module SPI and view it’s properties (press F4] if the Properties tool window isn’t visible):
Notice the option Project Output References. This will let us include the output of another project in this project’s SPI! Very slick… click the builder button … to open the dialog. This lets you include the output from another project into this project. Go ahead and add the Silverlight project and select the Deployment Type=ElementFile in the Feature.
All that’s left is to go into the element manifest (elements.xml) in the Module SPI and modify the element’s
URL attribute to provision the file into the desired location.
The tricky part to this is that by simply looking at the project structure in the Solution Explorer tool window in Visual Studio 2010, you can’t tell anything has been included in he project.comments powered by Disqus
BLOG POST CATEGORIES
- Critical Path Training
- Current Events
- DXCore CoreRush Refactor
- Football (US)
- MCMS 2002
- Media Center
- Microsoft 365
- Microsoft Cloud Show
- Microsoft Graph
- Microsoft Teams
- Personal Projects
- SharePoint 2003
- SharePoint 2007
- SharePoint 2010
- SharePoint 2013
- SharePoint Framework
- Windows Phone