Click here to Skip to main content
Click here to Skip to main content

How to Install a Silverlight Out-of-Browser Application (XAP) Silently?

By , 22 Apr 2010
 

Introduction

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 "How can you implement the Silverlight 3 Out Of Browser feature?" Also have a look into the following article to get the basic understanding of Silverlight 4 Out Of Browser feature "Silverlight 4: How can I create customized OOB Window?"

Hope, you read my previous articles on the Out of Browser application development and have confidence building applications. In those articles, you have seen that I wrote code for installing the OOB application from the browser window. Now imagine some scenarios where you want to install the Silverlight application (XAP) using your Installer silently without the user interaction. How can you do that? Silverlight 4 now came up with that feature for you. In this article, I will describe it and after reading it, you will be able to install your Silverlight OOB Application (XAP) silently in your local drive and run it from the desktop or startmenu without opening the browser.

How Silverlight Out-of-Browser Application Works?

Before going to implement the feature, we will first discuss how the Silverlight OOB application works. When you install Silverlight plug-in, it also installs a .exe file named "sllauncher.exe" which you can find in your "Program Files\Microsoft Silverlight\" directory. This EXE file now has the capability to install your Silverlight OOB application silently without opening the browser window. If you have already installed your OOB application, it will create a shortcut to launch the application from desktop or start menu. Right click on the shortcut & go to its properties. You will notice that the target location is set to "Microsoft Silverlight" and the target is set to something similar to the following line:

"C:\Program Files\Microsoft Silverlight\sllauncher.exe" 744317312.localhost

That is responsible for launching the XAP file as your Out-of-Browser application.

Script for installing Out-of-Browser application silently

Let's come to write some scripts to install your XAP silently as out of browser Silverlight application. Hope, you have a Silverlight application configured as out of browser. Build the application & you will get the output file (.XAP) in the ClientBin of the web application. Copy this file to your local drive in a specific folder (say, C:\MySilverlightApps\). I am using my Chromeless Window Demo Application and hence the complete path of the XAP is: "C:\MySilverlightApps\Silverlight4.OOB.ChromelessWindow.Demo.xap".

Now open your Notepad and write the following code in a single line:

"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   

code.png

Overview of sllauncher.exe Parameters

You have to pass the location of your XAP file as a parameter value to the "/install" flag.

You can specify the URL for future update location of the application by setting the "/origin" flag. When you call the CheckAndDownloadUpdateAsync() method from code, it will try to get the update from the specified location.

You can specify the shortcut location of the application by setting the value to the "/shortcut" flag. If you just set desktop or startmenu as the value to the flag, it will create the shortcut in desktop or startmenu depending on the parameter you set. If you use "desktop+startmenu" as the value to the parameter, it will install it both in the desktop and startmenu of your operating system.

Conclusion

You can use these feature to install Silverlight OOB Application from CD/DVD to your user's PC without any user interaction to open the application using browser window and manually install to their PC.

History

  • 22nd April, 2010: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

_ Kunal Chowdhury _
Software Developer
India India
Member
Kunal Chowdhury is a Microsoft MVP (Most Valuable Professional) in Silverlight Technology, a Codeproject MVP & Mentor, DZone MVB (Most Valuable Blogger), Speaker in various Microsoft events, Author, passionate Blogger and a Software Engineer by profession.
 
He is currently working as a Software Engineer II in an MNC located at Pune, India. He has a very good skill over XAML, C#, Silverlight and WPF. He has a good working experience in Windows 7 application (including Multi-touch) development too.
 
He posts his findings in his technical blog. He also writes for SilverlightShow and Codeproject portal. Many of his articles were highlighted as "Article of the Day" in Microsoft sites.
 
He also has another website called Silverlight-Zone.com where he posts article links on Silverlight, Windows Phone 7 and XNA accumulated from various web sites to help the community grow on specified technologies.
 
You can reach him in his Blog : http://www.kunal-chowdhury.com
He is also available in Twitter : http://twitter.com/kunal2383

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionHow can use this script for CD/DVD?memberEmre Gökberk5 Jun '12 - 22:23 
Hi, i want to run my Out Of Browser application from CD/DVD. In hard drive using /install:"C:\MySilverlightApps\Silverlight4.OOB.ChromelessWindow.Demo.xap", but what is the "C:\" in CD/DVD case? CD/DVD drive letter can be different for every PC?
Tnx.
AnswerRe: How can use this script for CD/DVD?mvp_ Kunal Chowdhury _6 Jun '12 - 3:49 
Emre Gökberk wrote:
what is the "C:\" in CD/DVD case? CD/DVD drive letter can be different for every PC?

That will be the drive letter of your CD/DVD drive. Yes, that will vary in different PC.
Regards - Kunal Chowdhury
Microsoft MVP (Silverlight) | Codeproject MVP & Mentor | Telerik MVP

 
Follow me on: My Technical Blog | Silverlight-Zone | Twitter | Facebook | Google+

QuestionXAP Singing while Auto UpdatememberDinesh Jethva DJ17 Nov '11 - 19:11 
Hi,
 
I need to Auto Update the XAP file while running the application in Elevated Trust mode.
 
For this it requires XAP signing. Following the steps in blogs, it doesnt work. Do you have any idea on this?
 
Thanks
Questioninstall directly from server instead "C:\MySilverlightApps\"memberjahedur.rahman30 Oct '11 - 22:08 
hi, thanks for positng this.
 
I noticed that the sllauncher.exe will install the latest version from C:\MySilverlightApps\xxx.xap. But in a real scenario, the xap file will be stored in the [web hosting server]/app/clientbin folder. If I want to allow my users to install the application silently, how would they refer the folder from the server instead using "C:\MySilverlightApps\"?
 
Thanks,
Jahedur Rahman

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 22 Apr 2010
Article Copyright 2010 by _ Kunal Chowdhury _
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid