If your XBAP has some “heft” to it (large resource files, large assemblies, etc), it may make sense to architect your app to use ClickOnce’s OnDemand APIs.
OnDemand APIs enable developers to delay download parts of the application. This can result in a friendlier end-user UX. Note: OnDemand files can be traditional resource files (e.g. images, xml files, etc) or assemblies.
Architecture Tips & Tricks
Got satellite assemblies or large resource files? Slim down your primary EXE to the bare minimum needed to start the app. Then, when the XBAP is launched, only the application manifest, deployment manifest, and primary EXE will be downloaded. As the user navigates around the xbap, you can use a second thread to download other files/assemblies silently in the background or show app-specific progress UI.
The Sample
I’ve created a sample XBAP that does just this:
- Has slim primary EXE.
- Utilizes 4 large image files and a controls dll. (Approx 3MB)
- When user navigates to xbap, she sees a landing screen while the controls dll & images are being downloaded on separate thread.
The major implementation steps are:
- Include resource files (i.e. images) as Content not Resource.
- No change to control assemblies.
- On the project properties page, select the publish tab. Click the Application Files button. Put the “OnDemand” files in to a separate group. (NOT “Required”.)
- Add a reference to System.Deployment
- Call the OnDemand Deployment APIs on a separate thread.
Try it out the xbap (RC 1). Get the code here.
Note: OnDemand APIs should only be called when applications are actually deployed using ClickOnce, not during F5 debug.
Pretty Illustrations
Step 1 above: Setting resources files as Content

Step 3 above: Setting resources files as Content

More Resources