How to build XBAP
Posted by anandkumar2004 on May 11, 2009
Windows Presentation Foundation is a new programming model to build rich windows smart client, media and document application . WPF support both Windows and Web based application .In this demo I am trying to build a web based WPF application called XBAP ( pronounced “ex-bap”) .XBAP stands for XAML browser application the most interesting point about XBAP is the application is hosted inside your web browser ,XBAP is the aggregation of web based and windows application . Initially I too got confuse between a standalone WPF application and a XBAP .In my next session I will cover the major differences between this two programming model , in this demo I am trying to navigate between two XBAP pages programmatically , I am using the NavigationService class to switch between two pages , here is the code snippet
private void button1_Click(object sender, RoutedEventArgs e)
{
Uri uri = new Uri(“Page2.xaml”, UriKind.Relative);
this.NavigationService.Navigate(uri);
}
The output of the application is a exe , yes compiler generates exe output .Now lets see what are the files are in debug/release folder

- An executable file. This contains the compiled code and has an .exe extension.
- An application manifest. This contains metadata associated with the application and has a .manifest extension.
- A deployment manifest. This file contains the information that ClickOnce uses to deploy the application and has an .xbap extension.
To access the application you need to You publish XBAPs to a Web server (Microsoft Internet Information Services (IIS) or later). You do not need to install .NET Framework on the Web server, but you do need to register the WPF Multipurpose Internet Mail Extensions (MIME) types and file extensions such as
| Manifest | application/manifest |
| .xaml | application/xaml+xml |
| .application | application/x-ms-application |
| .xbap | application/x-ms-xbap |
| .deploy | application/octet-stream |
| .xps | application/vnd.ms-xpsdocument |
To prepare your XBAP for deployment, copy the .exe and the associated manifests to your Web server. Create a hyperlink on a Web page to navigate to the deployment manifest. When the user clicks the link and navigates to the .xbap file, ClickOnce automatically handles the mechanics of downloading and launching the application.
Click Here for sample code
Cheers
Anand