The first Silverlight-for-SharePoint samples have been released, with doco, sample code, sample webpart and videos showing how to install.
All of the (6) samples available have both Silverlight 1.0 and 2.0 versions – I thought I’d go for the NEW version, even though it’s BETA (only a dev/play VM anyways).
The first of these samples is the “HelloSilverlight” control, containing the usual Hello World control (in 1.0 and 2.0 flavours)
There is also a “container” WebPart, which can be used to host a XAML file, or XAP file (new 2.0 version). This would be very useful – kinda like a Silverlight Content Viewer.
Here’s what you get in the package (FOUR zip files) :
1. HelloSilverlightSampleDoc
Contains a DOCX for the WebPart projects. The sample consists of two projects: one for the Silverlight 2 application and one for the SharePoint Web Part.
There are TWO files (DOCX) – one each for the Silverlight 1.0 and 2.0 versions.
2. HelloSilverlightSampleSetup
Contains SETUP.EXE files for
- Silverlight 1.0 Hello World WebPart
- Silverlight 2.0 Hello World WebPart
- Silverlight container (SilverlightPart) WebPart
3. HelloSilverlightSampleSource
Contains the source code for the THREE WebParts. For the 1.0 and SilverlightPart, there is a single project with the necessary CS files & lots more.
For the 2.0 version, there are actually TWO projects : the Silverlight 2.0 application project – and the WebPart to host the Silverlight application.
4. HelloSilverlightSampleVideo
Again – THREE files, showing how to install, and activate each of the WebParts – and then add to the page. Nothing special – but there are some cool bits within the video clip for the SilverlightPart control.
NB. All of the SIX sample projects have this same structure – DOCO, SOURCE, SETUP and VIDEO – very easy to get started and see how it works.
OK – so I ran the install’er like shown in the video – but when attempting to add the WebPart to the page, I get the following error :
It seems like the samples (setup) are “not enough” – and there are some additional steps required :
If you just install the Silverlight BluePrint samples onto a SharePoint Server, they will not work because the following dependencies must be installed:
Silverlight plugin (must be installed on the server !)
Silverlight 2 Software Development Kit Beta 1 (40.0 MB)
GAC the System.Web.Silverlight.dll – copy from C:Program FilesMicrosoft SDKsSilverlightv2.0LibrariesServer to C:windowsassembly
Check the /ClientBin/ directory of your SharePoint site for the existence of Silverlight.js. If missing (YEP !), copy it from C:Program FilesMicrosoft SDKsSilverlightv2.0Tools.
Register the MIME type for file extension .XAP in IIS – NB. didn’t need to do this for Windows Server 2008 (IIS-7)
Perform an IISReset – should now be able to add the SilverlightPart (!)
Thanks to Ian Morrish for the above tips/links – cool stuff !
Finally – HELLO WORLD ?!!? Nooooo !! The error no longer appears – but just shows as an empty WebPart box.
*hhmmm* Will have to investigate some more. It is a BETA version after all !!
Anyone been able to get the XAP version working ? (ie. Silverlight 2.0)
UPDATE (26/03/2008):
Have found some things that may be the cause/solution, after cracking open the code within Visual Studio 2008.
Script (INSTALL.BAT)
(1) Need to change some of the scripts that refer to “SL.HelloSilverlight20” – these should be “SL.HelloSilverlight2” – without an additional zero (ie. 2 not 20)
(2) Also have to update the file locations for CLIENTBIN and GACUTIL – that’s for MY environment, of course
(3) Lastly, ensure the URL being activated is correct – not http://silverlight.litwareinc.com
I was still getting an error on build, so I removed the POST-BUILD step – and run the PACKAGE.BAT – and then INSTALL.BAT files myself.
Solution Definition File
Interestingly, there is a bug/error in the PACKAGE step – which bundles up all files using the Solutionwsp_structure.ddf file.
If you open the file in VS-2008, the last line is wrong…>
TemplateImagesBluePrintsilverlight.jpg
should started with “12” …>
12TemplateImagesBluePrintsilverlight.jpg
Successful deploy
I can now step through/into the code for the WebPart – and ensure that each line is being executed – but STILL – no output !!
It looks like the Silverlight stuff and all JavaScript is being rendered out (from view source) – but isn’t displaying the control.
*phew* Will keep looking – something will pop out sooner or later…!