How to: Configure an Application for Out-of-Browser Support
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Updated: September 2010
Visual Studio provides designer support for enabling Silverlight-based applications to run outside the browser. This topic describes the designer support and the basics of out-of-browser configuration.
Note: |
---|
If your out-of-browser application requires network-based resources typically loaded after startup, you will also need to implement offline support. For more information, see How to: Implement Offline Support for Out-of-Browser Applications. Starting in Silverlight 5, system administrators can enable trusted applications to run inside the browser. However, these applications must still be configured as out-of-browser applications. For more information, see How to: Enable Trusted Applications to Run Inside the Browser. In Silverlight for Windows Phone, the desktop out-of-browser feature does not apply. |
To configure out-of-browser support
In Solution Explorer, select the Silverlight project for which you want to enable out-of-browser support.
On the Project menu, select project nameProperties.
On the Silverlight tab, select Enable running application out of the browser.
Click Out-of-Browser Settings.
The Out-of-Browser Settings dialog box appears.
Specify values for the indicated fields and then click OK. All fields are optional except for the following:
Window Title
Shortcut name
Application description
The following table indicates where each value is used and the corresponding property of the OutOfBrowserSettings or WindowSettings class.
Field |
Description |
Property |
---|---|---|
Window Title |
Appears in the title bar of the out-of-browser application window. |
|
Width and Height |
Indicates the initial dimensions of the out-of-browser application window. |
|
Set window location manually |
Indicates whether the initial position of the out-of-browser application window will be centered or positioned according to the specified Top and Left values. |
|
Top and Left |
Indicates the initial location of the out-of-browser application window. These fields are disabled if you do not select Set window location manually. |
|
Shortcut name |
Appears in the out-of-browser installation dialog box and on the installed application shortcut or shortcuts.
Note:
The ShortName value must remain the same across multiple versions of an application for the update mechanism to work correctly.
|
|
Application description |
Appears as a tooltip on the installed application shortcuts. |
|
Icon fields |
The operating system chooses the most appropriate icon to display in the following locations:
|
|
Use GPU Acceleration |
Indicates whether graphics performance is enhanced by using hardware acceleration. |
|
Show install menu |
Indicates whether the install option should appear on the application right-click menu. |
|
Require elevated trust when running outside the browser |
Indicates whether the application runs with relaxed security restrictions. |
|
Window Style |
Indicates the appearance of the title bar and border for the out-of-browser application window. |
If you do not specify Width and Height values, the application window will use a default size of 800x600.
If you do not specify icons, default icons will be used. If you do specify icons, you should specify one for each size indicated in the designer (16x16, 32x32, 48x48, and 128x128).
Icons must be .png files that you have added to the project and that have Build Action values of Content. Additionally, the .png files must be of the indicated dimensions. The operating system will choose the most appropriate size to use in different situations. If an appropriate icon cannot be loaded, the default icon will appear.
Note: |
---|
Silverlight 3 does not support the following properties: |
Example
The values in the Out-of-Browser Settings dialog box are used to generate an OutOfBrowserSettings.xml file located in the project Properties folder (My Project in Visual Basic). Any changes to this file are reflected in the designer. This file is used to populate the application manifest (AppManifest.xaml) with the specified values.
To configure an existing application for out-of-browser support without recompiling, add the configuration XML to the manifest in an existing .xap file. To do this, copy the Deployment.OutOfBrowserSettings property element from the following example code into the manifest file, and then update the values.
As an alternative to the designer, you can specify the out-of-browser settings by populating the manifest template (AppManifest.xml in the Properties or My Project folder) as shown in the following example. By default, the build uses the manifest template to generate the application manifest. However, the template XML is simpler to use in Visual Studio.
Note: |
---|
If you use the Out-of-Browser Settings dialog box, you cannot specify out-of-browser settings in the application manifest or the manifest template. Doing so will create duplicate information in the manifest. This causes an error when you attempt to run the application. |
<Deployment xmlns="https://schemas.microsoft.com/client/2007/deployment"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
<Deployment.OutOfBrowserSettings>
<OutOfBrowserSettings
ShortName="Out-of-Browser Application"
EnableGPUAcceleration="True"
ShowInstallMenuItem="True">
<OutOfBrowserSettings.Blurb>
Demonstrates the out-of-browser feature.
</OutOfBrowserSettings.Blurb>
<OutOfBrowserSettings.Icons>
<Icon Size="16,16">icons/16x16.png</Icon>
<Icon Size="32,32">icons/32x32.png</Icon>
<Icon Size="48,48">icons/48x48.png</Icon>
<Icon Size="128,128">icons/128x128.png</Icon>
</OutOfBrowserSettings.Icons>
<OutOfBrowserSettings.WindowSettings>
<WindowSettings
Title="Out-of-Browser Example"
Height="600" Width="600"
Left="0" Top="0" WindowStartupLocation="Manual"
WindowStyle="SingleBorderWindow"/>
</OutOfBrowserSettings.WindowSettings>
<OutOfBrowserSettings.SecuritySettings>
<SecuritySettings ElevatedPermissions="Required" />
</OutOfBrowserSettings.SecuritySettings>
</OutOfBrowserSettings>
</Deployment.OutOfBrowserSettings>
</Deployment>
See Also
Tasks
Concepts
Change History
Date |
History |
Reason |
---|---|---|
September 2010 |
Added note about ShortName restriction. |
Customer feedback. |