Skip to main content

Creating a Standalone, offline Installer for installing Silverlight runtime + your XAP application

Related Downloads


Recently a friend asked me to help him create an ‘installer’ to pack and distribute the Silverlight game he recently developed. He wanted to distribute his game via software download websites (like, and via medias like CD/DVD.

In fact, that is pretty easy (technically) - and this post is about creating and deploying Silverlight Runtime + Your Silverlight application (Xap file) using your very own custom, standalone, offline installer with out getting a browser installed - instead of the user installing your Silverlight application Out Of Browser via the web browser.

Alright. In this post, we’ll see how to build a standalone installer for Silverlight Nerd Dinner Client that I built some time earlier (It is a Silverlight client for Scott’s to enable nerds to ‘eat in packs’). The installer will start with a Splash screen as well ;). 


About License related issues, see the Appendix towards the end of this post. Also, the scenario I’m discussing is limited to creating installers for Windows machines alone :).


I can already hear you thinking, “why this is required”? Think about this - You created a Nice game or a Cool gadget in Silverlight. Now you want to create a standalone Installer - so that you can push the same to your potential users via various means. Like, users may download your installer via CNET like software websites - or you may distribute your installer via CD/DVD media etc. In this way, you can push your Silverlight apps to the masses- instead of waiting for them to come to your website and discover it – You got it, that is what we are talking about :).

So, in short, I think Silverlight can be used a platform of choice for building light weight desktop applications, mainly applications like utility tools, light weight games etc.

I feel there are a good number of use cases where you want to do this.

  • You can write and deploy tiny apps and gadgets - with out worrying about the presence of/version of the .NET runtime in user’s machine.
  • You can maintain the same code base for your web and desktop versions if the scenario suits.
  • You can contribute towards increasing the number of boxes where Silverlight exists :). More people with Silverlight = a brighter web ;)

And yes, if you are doubtful about what you can really do from a Silverlight application that is running in an elevated trust, out of browser mode, check out this epic post from Justin Angel where he demonstrates how to do all whacky things with Silverlight + COM, including accessing Win 7 APIs, Accessing Scanners and printers, Adding your OOB application to windows startup etc. He rocks.


So, let us see this in detail - how to create a stand alone installer to install Silverlight Runtime + Your Silverlight Application (i.e, the Xap file). These steps detail how I created my installer for Silverlight Nerd Dinner client.

1 – Preparing the required files

For this example, I’m going to use Nullsoft NSIS Installer to roll down the custom installer. NSIS is a simple windows installer from the WinAmp guys, and you can find ton of information here on that. You can write a custom NSIS script, and make a standalone installer executable out of that.

If you download the example package, you’ll find

  • The NSIS script to create the installer from.
  • The Silverlight runtime installer (Silverlight.exe) – You should ensure you have the latest from here.
  • Copy of your Silverlight Xap (that you are going to install in the user’s machine).
  • A license.txt file and splash.bmp file to show during the time of installation.

Download and Extract the Required Files zip - and have a look at the files I have. I’ve a Nerddinner.nsi script (we’ll soon see what is inside that), the Silverlight.exe runtime installer, SilverlightNerdDinner.xap, a license file and a Splash screen for the installer.



2 – What the installer should do

Basically, we need our installer to

  • Copy Silverlight.exe to the user’s machine and execute that in Silent mode to install the Silverlight runtime.
  • Use Sllanucher.exe to install our Xap in out of the browser mode (Sllauncher.exe will be installed by the above Silverlight runtime installer) – Tim already has a nice post on using sllauncher.exe – I’ll also touch that a bit.

The Silverlight deployment guide is a handy read regarding the supported command line arguments for Silverlight.exe and Sllauncher.exe, but here is the summary.

You can install the Silverlight runtime in quiet mode, using the following arguments. 

Silverlight.exe /q /doNotRequireDRMPrompt

The '/q' switch will install the runtime in silent mode. Here is some excerpt from the Silverlight deployment manual version 4.0

  • /q = quiet install or upgrade. This installs or upgrades Silverlight without seeing the GUI. When Silverlight is installed quietly, by default privacy related features such as DRM protected media playback and the Silverlight auto-update feature will be configured to prompt the user for permission on 1st use of the respective features. The Silverlight auto-update feature requires administrative rights so non-admin users will not be prompted.
  • /doNotRequireDRMPrompt = turns off the 1st use prompt allowing content protected by Digital Rights Management (DRM) to play without requiring any end-user intervention. When Silverlight is installed quietly, DRM Playback is set to prompt on 1st use by default.
  • /ignorewarnings = non-fatal warnings will not be reflected in the quiet installer return code but will instead return zero indicating success.
  • /noupdate = disables the Silverlight internal auto-updater.
  • /qu = quiet uninstall. This uninstalls Silverlight without seeing the GUI.

The Silverlight runtime installer will install sllauncher.exe to the {PROGRAMFILES}\Microsoft Silverlight\sllauncher.exe path. So, after installing Silverlight runtime, we may use sllauncher.exe to ‘install’ our xap in Out of Browser mode, and to create the required short cuts


You can see that Sllauncher.exe will accept the local path to the xap file, the url to the xap file and the shortcut options. Here is some excerpt from the Silverlight deployment manual about using sllauncher.exe to install XAP.


  • /install:"xapFile" – where xapFile is the file name/file path to the .xap file., E.g. /install:"c:\temp\sample.xap"
  • /origin:"xapURI" – where xapURI is the URI where the .xap file would've come from if not installed at the commandline
    • e.g. /origin:"" .  This URI will be used as the site of origin for security purposes. For example, for sandboxed applications, Silverlight networking requires a policy file check when making network requests to domains other than the site of origin.  The origin also serves as a unique ID for the application.  The xapURI must be an absolute URI not a relative URI, and must start with http:, https:, or file:.
  • /overwrite -- (optional) Overwrites any previously installed .xap with that xapURI.

Un installation

  • /uninstall  – Uninstalls the application specified in /origin. This is the same /origin value that was used to install the app originally.
  • /origin:"xapURI" – same as /origin for the install case

3 – The NSIS Script

So, now let us write a quick NSIS script to create an installer that performs these operations. Our script will look like this

Name "Nerd Dinner Desktop Installer"
OutFile "NerdDinnerDesktopInstaller.exe"
InstallDir "$PROGRAMFILES\NerdDinnerDesktop"

XPStyle on

Function .onInit
	# the plugins dir is automatically deleted when the installer exits
	File /oname=$PLUGINSDIR\splash.bmp "splash.bmp"
	splash::show 1000 $PLUGINSDIR\splash
	Pop $0

    SetOutPath "$INSTDIR"
    SetOverwrite ifnewer
    File "Silverlight.exe"
    ExecWait "$INSTDIR\Silverlight.exe /q /doNotRequireDRMPrompt"
    File "SilverlightNerdDinner.xap"
    ExecWait '"$PROGRAMFILES\Microsoft Silverlight\sllauncher.exe" /install:"$INSTDIR\SilverlightNerdDinner.xap" /origin:"" /shortcut:desktop+startmenu'

Basically, the installer will

  1. Show a splash screen during initialization of the installer
  2. Copy Silverlight.exe to the target folder, and execute it in quite mode
  3. Copy our xap file to the target folder, and use sllauncher.exe to install the xap

4 – Creating the Installer

Once you have NSIS installed, you can simply right click on an NSIS file to ‘Compile’ it create an installer.


You should see the MakeNSISW prompt, with a message that the installer is created. Our final installer (that contains Silverlight.exe runtime + XAP + Splash Screen image) is almost ~7 MB, and now you can distribute this the way you need, provided you have the permission from Microsoft to re-distribute Silverlight runtime.


The above installer will install your Silverlight application and will create the desktop and start menu short cuts. Try the installer from here, and you’ll see that it’ll get installed even in a machine with no Silverlight runtime already present.

When you create the installer from your own XAP file, make sure you have enabled Running your Silverlight Application out of browser. Also, always make sure you’ve the latest version of Silverlight runtime installer, Silverlight.exe (Normally what ever you get from this link )


Appendix - Licensing Issues

I asked Tim and Scott whether I can redistribute Silverlight runtime as part of my own custom installer. And this is the reply I got. There is a license available, but it depends on the situation. You should send your app details to Tim for the details :) Also, you might want to show the Silverlight license to the end users as part of your installer. I’m not pretty sure about this – the general recommendation is to fled Tim’s inbox.


Having said that, I really think MS should encourage developers to re-distribute Silverlight runtime as part of their custom installers, because that can definitely contribute towards increasing the Silverlight runtime penetration.

Shout it

Popular posts from this blog

MVVM - Binding Multiple Radio Buttons To a single Enum Property in WPF

I had a property in my View Model, of an Enum type, and wanted to bind multiple radio buttons to this.

Firstly, I wrote a simple Enum to Bool converter, like this.

public class EnumToBoolConverter : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (parameter.Equals(value)) return true; else return false; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return parameter; } #endregion }

And my enumeration is like

public enum CompanyTypes { Type1Comp, Type2Comp, Type3Comp } Now, in my XAML, I provided the enumeration as the ConverterParameter, of the Converter we wrote earlier, like

Creating a quick Todo listing app on Windows using IIS7, Node.js and Mongodb

As I mentioned in my last post, more and more organizations are leaning towards Web Oriented Architecture (WOA) which are highly scalable. If you were exploring cool, scalable options to build highly performing web applications, you know what Node.js is for.After following the recent post from Scott Hanselman, I was up and running quickly with Node.js. In this post, I’ll explain step by step how I’ve setup Node.js and Mongodb to create a simple Todo listing application.Setting up Node.jsThis is what I’ve done.1 – Goto, scroll down and download node.exe for Windows, and place it in your c:\node folder2 – Goto IIS Node project in Git at, download the correct ‘retail’ link of IIS Node zip file (I downloaded the already built retail package, otherwise you can download and build from the source).3 – Extract the zip file some where, and run the install.bat or install_iisexpress.bat depending on your IIS Version. If you don’t have IIS in…

Top 7 Coding Standards & Guideline Documents For C#/.NET Developers

Some time back, I collated a list of 7 Must Read, Free EBooks for .NET Developers, and a lot of people found it useful. So, I thought about putting together a list of Coding Standard guidelines/checklists for .NET /C# developers as well.As you may already know, it is easy to come up with a document - the key is in implementing these standards in your organization, through methods like internal trainings, Peer Reviews, Check in policies, Automated code review tools etc. You can have a look at FxCop and/or StyleCop for automating the review process to some extent, and can customize the rules based on your requirements.Anyway, here is a list of some good Coding Standard Documents. They are useful not just from a review perspective - going through these documents can definitely help you and me to iron out few hidden glitches we might have in the programming portion of our brain. So, here we go, the listing is not in any specific order.1 – IDesign C# Coding StandardsIDesign C# coding stand…