Deploying a WPF Application (WPF)
Updated: December 2009
After Windows Presentation Foundation (WPF) applications are built, they need to be deployed. Windows and the .NET Framework include several deployment technologies, including:
Microsoft Windows Installer.
Windows Remote Desktop Connection (RDC).
The deployment technology that is used to deploy a WPF application depends on the application type. In WPF, there are three application types:
XAML browser applications (XBAPs).
Browser-Hosted Extensible Application Markup Language (XAML) pages.
This topic provides a brief overview of each deployment technology, and how they are used in conjunction with the deployment requirements of each WPF application type.
This topic contains the following sections.
XCopy deployment refers to the use of the XCopy command-line program to copy files from one location to another. XCopy deployment is suitable under the following circumstances:
An application is self-contained; it does not need to update the client to run.
Application files must be moved from one location to another, such as from a build location (local disk, UNC file share, and so on) to a publish location (Web site, UNC file share, and so on).
An application does not require shell integration (Start menu shortcut, desktop icon, and so on).
Although XCopy is suitable for simple deployment scenarios, it is limited when more complex deployment capabilities are required. In particular, using XCopy often incurs the overhead for creating, executing, and maintaining scripts for managing deployment in a robust way. Furthermore, XCopy does not support versioning, uninstallation, or rollback.
For more information on XCopy, see How to: Deploy using XCopy.
Microsoft Windows Installer
Windows Installer allows applications to be packaged as self-contained executables that can be easily distributed to clients and run. Furthermore, Windows Installer is installed with Windows and enables integration with the desktop, the Start menu, and the Add/Remove Programs control panel.
Windows Installer simplifies the installation and uninstallation of applications, but it does not provide facilities for ensuring that installed applications are kept up-to-date from a versioning standpoint.
For more information on Windows Installer, see Windows Installer Deployment.
ClickOnce enables Web-style application deployment for non-Web applications: applications are published to and launched from Web servers. Although ClickOnce does not support the full range of client features that Windows Installer-installed applications do, it does support a subset that includes the following:
Integration with the Start menu and Add/Remove Programs control panel, for standalone applications.
Versioning, rollback, and uninstallation.
Online install mode, which always launches an application from the deployment location.
For more information on ClickOnce, see ClickOnce Deployment.
Remote Desktop Connections
WPF applications can be executed using Terminal Services. This requires installing a WPF application on a server with Terminal Services. A client can then use Remote Desktop Connection (RDC) to connect to the server and run the WPF application remotely.
The deployment options for a WPF application depend on the type of application. From a deployment perspective, WPF has three significant application types, including markup-only XAML applications, XBAPs, and standalone applications.
Deploying Markup-Only XAML Applications
Markup-only XAML pages are usually published to Web servers, like HTML pages, and browsed using Internet Explorer. WPF uses ClickOnce to facilitate browsing, although this is hidden from end users. Additionally, markup-only XAML pages run within a partial-trust security sandbox with restrictions that are defined by the Internet zone permission set. This provides an equivalent security sandbox to HTML-based Web applications.
For more information on security for WPF applications, see Windows Presentation Foundation Security).
Markup-only XAML pages can be installed to local disk using either XCopy or Windows Installer. These pages can be launched using Internet Explorer or Windows Explorer.
Deploying XAML Browser Applications
XBAPs are compiled applications that require the following three files to be deployed:
ApplicationName.exe: The executable assembly application file.
ApplicationName.xbap: The deployment manifest.
ApplicationName.exe.manifest: The application manifest.
For more information on deployment and application manifests, see Building a WPF Application (WPF).
These files are produced when an XBAP is built using MSBuild. Like markup-only XAML pages, XBAPs are typically published to a Web server and browsed using Internet Explorer.
XBAPs can be deployed to clients using either XCopy or Windows Installer. However, there are two considerations to make when deploying XBAPs in this way:
The XBAP is not automatically updated when a new version is published.
The XBAP runs with full trust, which is behavior that is inconsistent with the partial trust security model for Web applications.
Deploying Standalone Applications
Standalone applications are deployed using either ClickOnce or Windows Installer. Either way, standalone applications require full trust to run. Full trust is automatically granted to standalone applications that are deployed using Windows Installer. Standalone applications that are deployed using ClickOnce are not automatically granted full trust. Instead, ClickOnce displays a security warning dialog that users must accept before a standalone application is installed. If accepted, the standalone application is installed and granted full trust. If not, the standalone application is not installed.
To run a WPF application, the Microsoft .NET Framework must be installed on the client. Internet Explorer 7 automatically detects whether clients are installed with .NET Framework when WPF browser-hosted applications are browsed. If not installed, Internet Explorer 7 prompts users to install it.
To detect whether .NET Framework is installed, Internet Explorer 7 includes a bootstrapper application that is registered as the fallback Multipurpose Internet Mail Extensions (MIME) handler for content files with the following extensions: .xaml, .xps, .xbap, and .application. When these file types are navigated to, and the .NET Framework is not installed on the client, the bootstrapper application asks for permission to install it. If permission is not provided, neither the .NET Framework nor the application is installed.
If permission is granted, Internet Explorer 7 downloads and installs the .NET Framework using the Microsoft Background Intelligent Transfer Service (BITS). After successful installation of the .NET Framework, the originally requested file is launched in a new browser window.
.NET Framework auto-detection is available on Windows Vista, Microsoft Windows XP Service Pack 2 (SP2), and Microsoft Windows Server 2003 (SP1) clients that have Internet Explorer 7 installed.