jump to navigation

Deploying Silverlight Applications (XAP) February 17, 2012

Posted by Micah Rowland in Uncategorized.
trackback

It has been far too long since I last wrote and I thought I’d address a new type of application to deploy: Out-of-Browser Silverlight applications.

The Quest

A customer recently decided to spruce up its tablet/slate fleet by including some simple third-party Silverlight applications. These applications are normally downloaded and installed using a web browser. So the question was raised, “Can we install this programatically as part of the imaging process?” My interest was piqued and I embarked on my foray into Silverlight deployment.

We’ll use the Fandango Windows Slate located (for now) at http://images.fandango.com/mobile/slate/ as our example.

Upon navigating to the above web address, the site checks to see if the application has already been installed. If not, the user is prompted to Tap to Install, a simple feat to accomplish if you have fingers.  After tapping the prompt, a security warning dialog box appears and after a short countdown allows the installation by clicking/tapping the Install button.

Breaking out Sysinternals Process Monitor and filtering the data reveals the Silverlight.Configuration.exe, a prime suspect. A quick right-click Properties action and a tap on the Process tab gives us a place to start. The command-line being executed is:

“C:\Program Files (x86)\Microsoft Silverlight\4.0.60831.0\Silverlight.Configuration.exe” -installtrustedApp 3835182041.images.fandango.com 231aa8

The next step was to see if this command alone would install the application. Uninstall, cmd, paste, enter. No error message… but no program in the start menu and nothing in Programs and Features. A dead end? What could I be missing?

Time to break out Sysinternals Process Explorer. Let’s watch the install happen real-time and see what other related parent and/or child processes may be involved. Processes launch and close relatively quickly in Process Explorer, so to give myself the extra time I may need, I accessed the Difference Highlighting Duration dialog from the Options menu. Unfortunately this value is limited from 0-9 so 9 will have to work. Uninstall, then, side by side, reinstall the app and watch.

Internet Explore launches a Silverlight.Configuration.exe child process, which launches a second Silverlight.Configuration.exe child process, which launches a sllauncher.exe child proces, which launches a second sllauncher.exe child process. A new suspect! Inspecting the properties of the child process reveals this command-line:

“C:\Program Files (x86)\Microsoft Silverlight\sllauncher.exe” 3835182041.images.fandango.com

Very similar to the above Silverlight.Configuration.exe command-line. Let’s search for this sllauncher.exe and see if it has some command line arguments we can use. A quick search reveals the perfect article: How to Install a Silverlight Out-of-Browser Applications (XAP) Silently

JACKPOT? A quick read reveals a sample scenario involving deploying your own in-house developed XAP… Not quite what we have in mind but it’s a great start. The sample command-line they use is:

“C:\Program Files\Microsoft Silverlight\sllauncher.exe” /install:”C:\MySilverlightApps\Silverlight4.OOB.ChromelessWindow.Demo.xap” /origin:http://www.kunal-chowdhury.com/private/apps/ClientBin/Silverlight4.OOB.ChromelessWindow.Demo.xap /shortcut:desktop+startmenu /overwrite

Not a bad start, but not perfect for our needs. We don’t have the xap file that the website is using nor do we know the origin of the file. Now what? Let’s pop back open Sysinternals Process Monitor and take a look at the file changes during install, maybe we can find a locally stored copy?  Pause and clear the capture, set the filters back to default, add a filter to include only sllauncher.exe processes, uninstall the app, start capture, install the app. Now filter only file operations and… nothing. Let’s try Silverlight.Configuration.exe… nope. Let’s try path contains xap… BINGO! An application.xap file in the folder 3835182041.images.fandango.com. We’ve seen that path before. The full path to that xap is:

C:\Users\Micah\AppData\Local\Microsoft\Silverlight\OutOfBrowser\3835182041.images.fandango.com

Ok, what have we got? Let’s see, we have an icon, a png of the icon, the application.xap file, an index.html file and 3 un-extensioned files: installstate, metadata, and state. Well it’s a good bet that the application.xap file is the source we need… what about the origin parameter? The installstate and state files are empty (probably flag files), but the metadata is the jackpot we’ve been waiting for:

ShortcutName=Fandango Slate Application
LaunchPath=C:\Users\Micah\AppData\Local\Microsoft\Silverlight\OutOfBrowser\3835182041.images.fandango.com\index.html
CustomIcon=1
TrimmedSourceDomain=images.fandango.com
TrimmedTitle=Fandango Slate Application
TrimmedName=Fandango Slate Application
ElevatedPermissions=2147483647
XapLastModified=Tue, 02 Aug 2011 23:16:17 GMT
EnableGPUAcceleration=True
WindowStartupLocation=0
WindowTop=0
WindowLeft=0
WindowWidth=1367
WindowStyle=1
WindowHeight=767
SourceDomain=images.fandango.com
OriginalSourceUri=http://images.fandango.com/mobile/slate/ClientBin/Fandango.Slate.xap
FinalAppUri=http://images.fandango.com/mobile/slate/ClientBin/Fandango.Slate.xap
RuntimeVersion=4.0.50826.0
AppID=3835182041.images.fandango.com
Description=Fandango Slate Application on your desktop; at home, at work or on the go.
Title=Fandango Slate Application
Name=Fandango Slate Application

OriginalSourceUri looks PERFECT. Just to make sure we really have the original XAP file, let’s download that XAP, maybe the xap file changes when downloaded and installed (ok maybe not, but we can’t be too safe). Copy pasting that address into IE gives us a downloaded copy!

As far as the remaining two parameters, shortcut and overwrite: The overwrite parameter is not needed for MDT deployments or if you are sure the app has never been deployed before. Adding overwrite prevents an error from being thrown if the application already is installed. The shortcut parameter can be left out or set to one of the following:

  1. desktop
  2. startmenu
  3. desktop+startmenu

Let’s roll it all together: Place the xap file in a folder and our local command-line is as follows:

“C:\Program Files (x86)\Microsoft Silverlight\sllauncher.exe” /install:“Fandango.Slate.xap” /origin:http://images.fandango.com/mobile/slate/ClientBin/Fandango.Slate.xap /shortcut:startmenu /overwrite

Caveats

Silverlight 5 was released on December 9, 2011 and has a 64-bit installer. This means that if you are installing Silverlight 5, the path to sllauncher will always be C:\Program Files, regardless of the OS architecture, making our job simpler, one command-line for all 🙂

These applications are installed on a per-user basis, so for MDT deployment, make sure copyprofile=true.

Some Out-of-Browser Silverlight apps may require Native Extensions For Microsoft Silverlight which you can find here as an msi download. Install the extensions before deploying the apps to avoid dependency issues.

Summary

So, to summarize:

  1. On a test machine, download and install the desired Silverlight Out-of-Browser application
  2. Navigate to %LOCALAPPDATA%\Microsoft\Silverlight\OutOfBrowser and open the appropriate application folder.
  3. Open the metadata file in notepad and copy the OriginalSourceUri path.
  4. Paste the path the address bar of your browser and download the XAP file.
  5. If using MDT, copy the XAP to a folder and import.
  6. Use the command-line syntax as follows:
    • 64-bit OS: “%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe” /install:[XAP FILE] /origin:[ORIGINALSOURCEURI PATH] /shortcut:[DESIRED SETTING] /overwrite
    • 32-bit OS: “%ProgramFiles%\Microsoft Silverlight\sllauncher.exe” /install:[XAP FILE] /origin:[ORIGINALSOURCEURI PATH] /shortcut:[DESIRED SETTING] /overwrite

Credit: I ran across a great article on Tim Heuer’s blog while proofing this draft that I failed to locate when it was originally started and would be remiss not to mention. It’s a great echo of what I’ve covered here but doesn’t cover third-party apps.

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: