×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

One of the features we are introducing in Silverlight 4 is a ‘silent install’ mechanism for out-of-browser applications.  Currently every out-of-browser application (trusted or not) starts from an in-browser mechanism.  In some instances where you want to deploy the app via managed desktop software or perhaps via CD-ROM, you don’t want to have to tell the user to start on an HTML page first.

Now I’m not going to write here about the merits of why you might want to do this other than to point out what I believe to be the 2 prominent scenarios: managed desktop deployment and CD/DVD distribution.  I know some of you might be thinking Well if it is a managed desktop environment, why not just use WPF then? – and I would pose the same question to the customer as well first.  But again, this post is to merely outline the capabilities and I’ll let you all debate the reasons :-)

The function still requires the Silverlight plugin to be installed (and requires Silverlight 4).  It would also require the ability to install out-of-browser applications (there is a possibility for an administrator to disable this feature).  Given those two requirements, the key tool at your disposal is sllauncher.exe.  This is installed with the plugin and is located at %ProgramFiles%\Microsoft Silverlight on the machine.

NOTE: The features I’m describing here are for Windows machines.  Out-of-browser applications on OSX are actually deployed as ‘apps’ (.app) versus how just the XAP is deployed on a Windows machine.  I’m investigating how to do something similar here with scripting on OSX, but I’m unfortunately not a Mac developer :-).

Let’s take a look at the required steps and a scenario.

The Setup

You’ll need to ensure that the plugin is installed as I mentioned earlier.  You’ll also want to have a copy of the XAP handy that you’ll want to be installing.  This would be the main XAP and would be the same one that would be in the Source parameter of the <object> tag where you normally would host this.

NOTE: Because “Program Files” is different on 32- and 64-bit machines you’ll want to make sure your script/installer can handle the determination of where the sllauncher.exe program will be.  Since it isn’t a native 64-bit app, it will be in “Program Files (x86)” on a 64-bit machine.  This sometimes can cause confusion because the %ProgramFiles% environment variable on 64-bit is the native program files directory and *not* the x86 one.

Your Silverlight XAP will already have to have been configured for out-of-browser and have the appropriate manifest information within it.

Once you have those you can move on to understanding the parameters.

The Options for Install

The sllauncher.exe program for install require at a minimum 2 options and I’ll suggest that you always use all 4 I will describe here.

/install:”path-toXAP-File” – this is the first and points to the XAP file you are wanting to install.  This might be on a network share, on the CD, or in an installer.  This is required.

/origin:”URI-to-origin” – this is the ‘origin’ of the XAP and is required.  Even though you might not be using auto-update features, etc. you must set this.  I actually recommend being smart about it and having the XAP on a real URI endpoint as well so that your origin is actually real.

/shortcut:desktop+startmenu – while this is optional, it actually seems silly not to include at least one – or your users will have a hard time launching your application!  You can use: desktop, startmenu, or desktop+startmenu (my recommendation).

/overwrite – this option confirms the XAP you are installing will overwrite any existing version currently there.  This is optional, but again, I think you should use it.

Let’s assume the following scenario using the Silverlight Client for Facebook application as an example.  I have the XAP (Silverface.xap) that I want to deploy.  I would use the following command:

   1: "%ProgramFiles%\Microsoft Silverlight\sllauncher.exe" 
   2:     /install:"Silverface.xap" 
   3:     /origin:"http://www.silverlight.net/content/samples/apps/facebookclient/ClientBin/Silverface.xap" 
   4:     /shortcut:desktop+startmenu /overwrite

This assumes that I’m calling this command from where the Silverface.xap is currently.  Notice that the origin parameter points to the XAP origin and not the site hosting it.  This is important.  This above command would install the app and create shortcuts.

Automatically Launching the App

So what if you wanted to also automatically launch the app after installing (i.e., the CD/DVD ‘autorun’ scenario).  You again would use sllauncher.exe to do this for you after you’ve installed the app.  Using our same sample above here would be the command:

   1: "%ProgramFiles%\Microsoft Silverlight\sllauncher.exe" 
   2:     /emulate:"Silverface.xap" 
   3:     /origin:"http://www.silverlight.net/content/samples/apps/facebookclient/ClientBin/Silverface.xap" 
   4:     /overwrite

Notice the emulate command.  This is the launcher.  Now you’ll notice that this isn’t the same command-line options if you looked at an installed applications’ created shortcuts.  Because the folder where the XAP gets installed is pretty random, we use the origin as the hint to the sllauncher.exe program to find the right app for us and start it up.  I’ve found that using /overwrite will also give a more consistent behavior.

Uninstalling the App

What if now you want to uninstall the app?  Perhaps the managed desktop admins deprecate an application or you want the CD/DVD experience to be a non-transient one and clean up when done.  The command again is simple:

   1: "%ProgramFiles%\Microsoft Silverlight\sllauncher.exe" 
   2:     /uninstall 
   3:     /origin:http://www.silverlight.net/content/samples/apps/facebookclient/ClientBin/Silverface.xap

Instead of the install parameter you use the uninstall parameter.  Again, notice the use of the origin parameter – this is critical in all these tasks.  The above command would remove the application and essentially does the same thing as the right-click Remove this application context menu option in Silverlight.

Using these commands in Installers

While I think those that actually have a need for this option will be using scripts and batch files, I do think some may want to include this in an installer experience.  The only option I can see for this is because you are also deploying some additional items along with your XAP (perhaps assets to the user’s document store that the app will use later like plugins or something).  Other than that if you are creating an installer simply to wrap the above methods, it might not seem wise.

Why, you ask?  Well if you think about it, your installer itself will stamp an entry into Windows as an installed application and Silverlight will also stamp an entry.  In our Facebook example, the Add/Remove Programs would show 2 “Silverlight for Facebook” entries (assuming we named our installer that as well).  This would likely confuse the user.  I’m not saying it isn’t impossible to do this nor is it difficult to manage, I just think it looks odd.

Regardless, if you are using something like InstallShield (FYI look for InstallShield LE in Visual Studio 2010…it’s very good) or the Visual Studio Setup projects, you can include a Custom Action to these installers.  The process would be a custom action *after* the install is complete because you need to locate the XAP to install.  Most setup programs are easy to use and provide pre-configured platform-specific environment variables you can use to map to things like the correct Program Files directory.

In the ideal situation you’re batch file/installer should check for the presence of Silverlight (and the correct version).  These can be done using file path verification or registry checking, both of which are outlined in the deployment guide whitepaper.

What about redistribution of Silverlight?  Right now we do not have broad redistribution rights for Silverlight.  You will still need to point users to where they can get the plugin so that they can be presented with the EULA and get the correct version for their platform.

If you do use the installer route, make sure that you account for clean un-installations as well!

Other insights and summary

You may be asking yourself if the user will be prompted here to install the application?  The answer is no.  Since this is essentially a command-line execution, the trust is implied here.  The user first has to knowingly type the command (not likely) or knowingly execute your install mechanism (batch file, installer, whatever).  These commands cannot be automatically run from the browser, for example.  For managed desktops, sure, these may be silently installed.  This is intended because in a managed desktop environment the software is, well, managed.  An elevated or normal-privileged application will install just the same using these methods.

As to the shortcuts (the /shortcut parameter being optional).  I think we’re going to fix that in some update.  Again, it’s a bit foolish to not provide one so consider it required :-).

If you find yourself in a situation needing this, hopefully it will come in useful.  I really think this is a helpful tool, but also a niche tool.  Those of you creating general consumer applications/sites will not benefit here really because you’ll likely start with an in-browser instance anyway.  But for those using managed desktop environments, or thinking about CD ‘autorun’ type situations, hopefully this information will come in useful.


This work is licensed under a Creative Commons Attribution By license.


3/26/2010 3:23 AM | # re: Installing Silverlight applications without the browser involved
Great. This is what I have been looking for. Just one question, what approach do you suggest if I want to do a silent launch from browser i.e., should I write a separate plugin for this? Is there something like click-once available for Silverlight as well?
3/26/2010 3:58 AM | # re: Installing Silverlight applications without the browser involved
Great job, Tim! The Silverlight Team continues to amaze me. Being using SL and WPF since the first betas I'm finding it very hard to find scenarios for WPF.
Gravatar
3/26/2010 8:35 AM | # re: Installing Silverlight applications without the browser involved
This looks like it would be really easy to set up with an NSIS installer. With NSIS you have full control and responsibility over every action the installer takes, including making an entry in the uninstall list, so there's no problem with duplicate entries. A "hello world" NSIS installer does nothing more than display a message box, for example.

Another reason why someone might want to do what you've outlined here... It sounds like you could use this to create an offline installer for your app. This stuff works without an Internet connection, right? Sometimes it's really annoying to have an Internet connection be required for app installation.
3/29/2010 2:37 AM | # re: Installing Silverlight applications without the browser involved
Hi Tim,
It looks like that emulate requires xap path specification and that "emulate" option, as name implies, does not requires the app to be installed, it just run the app even if not installed.
Do you confirm?
3/29/2010 8:04 AM | # re: Installing Silverlight applications without the browser involved
Corrado -- at least not for me that is not the exhibited behavior. The intent of emulate is to launch the installed app based on the origin URI.
3/29/2010 3:26 PM | # re: Installing Silverlight applications without the browser involved
Bhupesh - launching an OOB app from in-browser is not supported right now. There are APIs for you to inform the user that they already have the application installed and tell them to run the installed application.
4/1/2010 6:16 AM | # Installing Silverlight OOB applications on a Terminal Server
Hi Tim,

Great stuff you got here! I was wondering though whether there was a way to install the app for all users on a computer. I'm asking because the "per-user" installation mode would not really work on Terminal Servers for instance. It also makes it harder to deploy the app enterprise-wide.
4/4/2010 11:38 PM | # re: Installing Silverlight applications without the browser involved
great article
5/10/2010 6:59 AM | # re: Installing Silverlight applications without the browser involved
Oivind/blaze -- not an equivalent right now in order to do the above.
5/20/2010 8:22 AM | # re: Installing Silverlight applications without the browser involved
> Corrado -- at least not for me that is not the exhibited behavior.
> The intent of emulate is to launch the installed app based on the origin URI.

I'm seeing the same behavior Corrado mentioned. I can't get "sllauncher /emulate" to run an already installed app. If I add the /overwrite switch with /emulate then it actually uninstalls the app. Any thoughts appreciated.
5/20/2010 10:52 AM | # re: Installing Silverlight applications without the browser involved
> Corrado -- at least not for me that is not the exhibited behavior.
> The intent of emulate is to launch the installed app based on the origin URI.

>MarkTap --I'm seeing the same behavior Corrado mentioned. I can't
> get "sllauncher /emulate" to run an already installed app. If I add
> the /overwrite switch with /emulate then it actually uninstalls the app. Any
> thoughts appreciated.

I am unable to launch the installed application as well and am experiencing the same behaviour as Corrado and MarkTap.
And is it possible to pass initialization parameters to the application?
Any help is much appreciated.
5/25/2010 3:04 AM | # re: Installing Silverlight applications without the browser involved
Tim,

If you want to pursue the batch file route, there's a simple way to detect whether you're running on 64-bit or not. As you mentioned, on 64-bit, the location is Program Files (x86). This location doesn't exist on 32-bit machines. And neither does the environment variable that points to it - ProgramFiles(x86). So you can just use something like the following as the basis for a batch file:

:: Is this a 64-bit machine?
@echo off

if exist "%ProgramFiles(x86)%" (
:: We're on 64-bit
set sllauncherlocation="%ProgramFiles(x86)\Microsoft Silverlight\sllauncher.exe"
) else (
:: We're on 32-bit
set sllauncherlocation="%ProgramFiles%\Microsoft Silverlight\sllauncher.exe"
)
:: then run as above
%sllauncherlocation% /install:"myApp.xap" ...

Obviously, you can make the batch as complex as you want, but it's a start at least
5/27/2010 12:51 AM | # re: Installing Silverlight applications without the browser involved
Hi Tim, I am creating a desktop installer for my application..
But its not yet hosted ...
or you may say..Its just on a public IP..
When I compile the nsi script giving that public IP(of course)..but I am not able to install it properly...
Can you tell if public IP is accepted as origin or not..
or whats the alternate..
5/27/2010 8:07 AM | # re: Installing Silverlight applications without the browser involved
Pratibha - actually you can put whatever...are you sure you have the right LOCAL path though?
5/28/2010 12:38 AM | # re: Installing Silverlight applications without the browser involved
hey Tim I am right..
Just take a look...
Name "SilverlightProject2 Desktop Installer"
OutFile "SilverlightProject2DesktopInstaller.exe"
InstallDir "$PROGRAMFILES\SilverlightProject2"

XPStyle on

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

Section
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "Silverlight.exe"
ExecWait "$INSTDIR\Silverlight.exe /q /doNotRequireDRMPrompt"
File "SilverlightProject2.xap"
ExecWait '"$PROGRAMFILES\Microsoft Silverlight\sllauncher.exe" /install:"$INSTDIR\SilverlightProject2.xap"
/origin:"http://(an IP address)/SilverlightProject2/clientbin/ SilverlightProject2.xap"
/shortcut:desktop+startmenu'
SectionEnd

Can you please check whats wrong out here..
Means everything seem to be fine..
But the project is not getting installed on local Desktop





6/18/2010 3:02 AM | # re: Installing Silverlight applications without the browser involved
Hello Tim..
Can you please tell how to open the out of browser in maximized form using nsi
7/11/2010 9:01 AM | # re: Installing Silverlight applications without the browser involved
Hi Tim
Great post.
I will ask again, Is it possible to do this on a Mac/OSX?
We are now facing a real buissness scenario with this problem..

Thanks again
Dani
9/12/2010 8:04 PM | # re: Installing Silverlight applications without the browser involved
I'm seeing the same behavior as MarkTap - when I run it after install using Emulate it deletes my installation and runs the local .xap file. I then have to reinstall it. I tried removing the overwrite option and hiding my local .xap but it still uninstalls it - I could not get this to work. ps - if you are having problems getting this working, check your
C:\Documents and Settings\Rod\Local Settings\Application Data\Microsoft\Silverlight\OutOfBrowser\index
to see if the .xap file is being copied...
9/13/2010 4:05 PM | # re: Installing Silverlight applications without the browser involved
Tim, can you please elaborate on the licensing when you ship the Silverlight runtime - I would assume MS would want the extended "reach" but I saw your comment on the article about packaging it with an installer.

How do we go about this legally?
10/21/2010 2:47 PM | # re: Installing Silverlight applications without the browser involved
Tim,
Is there any way we can pass initialization parameters to a OOB application?
12/8/2010 8:48 AM | # re: Installing Silverlight applications without the browser involved
Tim,

I have found when running this, the application does not get isolated storage pool created. For now we are only needing to store an ID, so even the default amount would be fine. Is there some limiting factor with this install method that does not setup the isolated storage?

Thanks!
-Tony
12/29/2010 12:14 AM | # re: Installing Silverlight applications without the browser involved
Hi Blaize,

Your article was very useful. Thank you for all the offline help. One issue that I faced while installing in other machines was the userid and groupid which got attached to the Packagemaker. I found out that by changing the permissions for the files in Packagemaker, I was able to install it on any m/c. Now my application works both on Mac and Windows and with an inbuiilt Sterling database.
7/10/2011 12:47 PM | # re: Installing Silverlight applications without the browser involved
"This is a very informative article.I was looking for these things and here I found it. I am doing a project and this information is very useful me. If you are interested, but this is my duty to inform you that virtual administrative assistant a very dedicated service and can be applied anywhere you want and get better results.Cavity Wall Insulation


7/11/2011 4:59 AM | # re: Installing Silverlight applications without the browser involved
Great work you have done to share with everyone. simply excellent. Thanks for sharing a nice you have given us so great a collection of information Zakłady bukmacherskie
7/11/2011 5:03 AM | # re: Installing Silverlight applications without the browser involved
Silverlight 4 now has support for installing out-of-browser application silently. If you are new to Silverlight Out-of-Browser application development, you can read the complete guide in Also have a look into the following article to get the basic understanding of Silverlight 4 Out Of Browser feature discount cars
7/18/2011 7:27 AM | # re: Installing Silverlight applications without the browser involved
Thanks for this great post.
I have a problem though.
The silent install works fine (we use it when the people have no network connection available at the time), but when we plug the computer onto the network and want to use the application in a connected mode, it doesn't work (no connection to the server).
Is this normal ?
Is there a way to do this ?

Thanks again.
Gravatar
8/17/2011 2:59 AM | # re: Installing Silverlight applications without the browser involved
Hi Tim,
Is it possible to do the same for Windows Phone 7 Apps?
8/17/2011 11:08 AM | # re: Installing Silverlight applications without the browser involved
Hi, Tim,
I was wondering if there is a silent install switch for NO shortcuts. My company wants this, and I'd prefer not to have to rely on a custom post-install script, which would also have to account for variable shortcut location by OS (XP, Vista, Win7, etc.).

Thanks!

"/shortcut:desktop+startmenu – while this is optional, it actually seems silly not to include at least one – or your users will have a hard time launching your application! You can use: desktop, startmenu, or desktop+startmenu (my recommendation)."

8/22/2011 2:51 PM | # re: Installing Silverlight applications without the browser involved
Letting go and saying goodbye is the hardest part of our lives. As the director of the office, I really felt sad, but happy to say goodbye. Your message very inspiring.cauciucuri de iarna
11/8/2011 8:09 AM | # re: Installing Silverlight applications without the browser involved
I'm trying to run a Silverlight application from a location of my choice. The problem is that this doesn't work if the target path contains spaces. Does anyone know if there is a work around?

Doesn't Work:
---> sllauncher "c:\Program Files\SLOOB"

Works:
---> sllauncher "c:\SLOOB"

Thanks.
11/15/2011 3:25 AM | # re: Installing Silverlight applications without the browser involved
Hi tim,

Great article!!!
I tried it and worked fine but somehow silverlight app do not update itself if i change xap version of server(Auto update code not working). Do you see any visible problem with this?

PS : I have written out of browser auto update code and it works perfactly fine in normal install. and my app have elevated trust.

Thanks,
Sameer Azazi
11/17/2011 10:14 PM | # re: Installing Silverlight applications without the browser involved
It's a great fit for Silverlight, where your application is running on the client and likely needs to access backend data.
12/23/2011 2:06 AM | # re: Installing Silverlight applications without the browser involved
Hi Sir,

I have my silverlight application as OOB.

While using sllauncher.exe i dont have a website to specify origin.

Is there a way to skip origin or any other way to specify origin.

Thanks,
Ahobul
9/17/2012 2:23 AM | # re: Installing Silverlight applications without the browser involved
There is no definition of beauty, but when you can see someone's spirit coming through, something unexplainable, that's beautiful to me.
7/10/2013 8:18 AM | # re: Installing Silverlight applications without the browser involved
I am having an issue where the short cuts are not be installed.

It works on the systems when the logged in user is an administrator, but if the user does not have administrator rights, but instead has the administrator enter the password to run the install as an administrator, the shortcuts are not installed.

Following is the command used in the install. I have also tried running this from the dos prompt (runas administrator), but the shortcuts are not created and the files are not added to the C:\Users\Regular\AppData\Local\Microsoft\Silverlight folder like they are when installing when the logged in user is an administrator.

C:\Program Files\Microsoft Silverlight\sllauncher.exe /install:"GridSense_Insite_Local.xap" /origin:"C:\Program Files\GridSense\GridSense Local\GridSense_Insite_Local.xap" /shortcut:desktop+startmenu /overwrite

Any ideas why this is failing?
8/16/2013 12:43 PM | # re: Installing Silverlight applications without the browser involved
Just in case anyone else is attempting to install a silverlight app when the user is not an administrator. Following is how I solved it.

Instead of installing the app using the sllauncher.exe as described above, I created shortcuts when installing the app (Using InstallShield). The shortcuts use the emulate command.
The InstallShield setup.exe forces administraator rights and therefore the user would need the administrator to install the app, but after that, it works fine

Following is the complete command line to launch the program.

"C:\Program Files (x86)\Microsoft Silverlight\sllauncher.exe" /emulate:"C:\Program Files (x86)\GridSense\GridInsite Local\GridSense_Insite_Local.xap" /origin:"C:\Program Files (x86)\GridSense\GridInsite Local\GridSense_Insite_Local.xap"

In Installshield, the target for the shorcut is:
[ProgramFilesFolder]Microsoft Silverlight\sllauncher.exe

While the arguments are:

/emulate:"[INSTALLDIR]GridSense_Insite_Local.xap" /origin:"[INSTALLDIR]GridSense_Insite_Local.xap"

If you create the shortcuts in the Users\Public\Public Desktop folder like I did, the program can be run as any user on the computer.

3/11/2014 4:17 PM | # re: Installing Silverlight applications without the browser involved
Can the path after /emulate: be a web share ?

 
Please add 1 and 5 and type the answer here:

DISCLAIMER:

The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.