web 2.0

Silverlight OOB – Under the hood

I’ve experienced several problems and I have to take a closer look on OOB, how it works and how we can for example install our silverlight application from CD.

Out of Browser is a feature of Silverlight 3+ Applications, where the user can install the application to the desktop and you as a developer can provide more functionality, especially when application is installed as trusted.

If you want to explore where the OOB applications are located in users hard drive, how they are launched and how to allow the user to install Silverlight Application from CD, continue reading.

Important methods, properties for OOB in Silverlight

Application.IsRunningOutOfBrowser (Gets a value that indicates whether the application was launched from the out-of-browser state.)
Application.Install() (Attempts to install the application so that it can run outside the browser.)
Application.InstallState (Gets the current out-of-browser installation state of the application.)
InstallState Enumeration (Defines constants that indicate the installation state of an application that is configured to run outside the browser.)

A complete guidance on Out of Browser Support in Silverlight.

Where to find installed OOB applications?

A list of all silverlight applications is available in a hidden folder
C:\Users\{user name}\AppData\LocalLow\Microsoft\Silverlight\OutOfBrowser\
Notice also a folder sibling …\Silverlight\is\ which is an isolated storage for running Silverlight apps.

Name of the files in this folder is done by the address of the location (e.g. localhost, microsoft.com). Most of these files are empty, but those which are installed for OOB mode has some information within. Open that file and you will see the ID of the application and the whole URL where the original (web version) is located. ID with name of file creates ApplicationID (e.g. 972856442.localhost, 3326975874.zdechovan.com) which we will use to launch our application in a section below.

How to launch a Silverlight OOB?

There is an application sllauncher.exe, that is used to launch Silverlight application in Out of Browser mode. This application is located in C:\Program Files\Microsoft Silverlight\sllauncher.exe.

To run a silverlight application you have to pass some parameters to this sllauncher, if you try to run it without any of them, you’ll see the usage pattern:

SLLauncher.exe [app_id] [debug] [/install:<file path to XAP>]
[/emulate:<file path to XAP>] [/overwrite] /origin:<original app uri>
/uninstall /shortcut:<desktop|startmenu|desktop+startmenu|none> [/pid]

You can experiment with a lots of variations of parameters set up if you wish, for me, the most importat is to set a shortcut, which will launch our application. It’s because I experienced a problem, that after install from application the shortcut was corrupted and didn’t work.

Working shortcut should contain {path to sllauncher}/sllauncher.exe {ApplicationId} so for example C:\Program Files\Microsoft Silverlight\sllauncher.exe 972856442.localhost in my case.

If you want to debug your OOB application simply add a debug parameter.

I found an article Installing Silverlight applications without the browser involved by Tim Heuer about how to use  sllauncher to install/uninstall a silverlight application.

One Response to “Silverlight OOB – Under the hood”

  1. [...] This post was mentioned on Twitter by Solidsoft. Solidsoft said: Silverlight & WCF RIA Services » Blog Archive » Silverlight OOB …: Silverlight & WCF RIA Services. Bachelor … http://bit.ly/aYjg3O #WCF [...]