In WPF, we support two main app models: standalone and XBAP.
Standalone apps are akin to traditional Windows apps. They run in their own window. They tend to be fully trusted (unrestricted access to the computer and its resources). And they are installed (either via an MSI, ClickOnce, or EXE distribution).
XBAPs, on the other hand, are browser hosted applications. They’re cached (using ClickOnce) and sandboxed. Users navigate to them (promptlessly) in the browser like they do any other website. (XBAP whitepaper & sandbox whitepaper)
What’s great then is, if you’ve written your app in a security & navigation friendly way, converting between standalone & XBAP is as easy as flipping a few project settings.
Flexible Application VS Template
In order to facilitate switching between app models, I’ve written a “Flexible Applcation” VS template. It enables you to maintain a single application project file and easily compile as standalone or xbap based on application configuration.
How do I use it?
When creating a project, select “Flexible Application (WPF).” (Template installation structions below.)
When building/running the app, choose the configuration that you want:
Debug and Release will build a standalone app. XBAP Debug and XBAP Release will produce an XBAP
How do I install FlexibleApplication template?
Copy this zip file to “%userprofile%My DocumentsVisual Studio 2005TemplatesProjectTemplatesVisual C#”. Don’t unzip the file – just copy the zip file as is.
This version of the template does not support publishing. For more information, see the template readme.
Some thank yous
– WPF SDK for a great cube app. (WPF SDK team’s blog)
– Ashish Shetty & Dennis Cheng for their VS template help.
– Beatriz Costa for her help setting up the XAML databinding