XBAPs: OnDemand & ClickOnce

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:

  1. Has slim primary EXE.
  2. Utilizes 4 large image files and a controls dll. (Approx 3MB)
  3. 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:

  1. Include resource files (i.e. images) as Content not Resource.
  2. No change to control assemblies.
  3. 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”.)
  4. Add a reference to System.Deployment
  5. 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

  1. MSDN ClickOnce Deployment and Localization
  2. MSDN ClickOnce OnDemand Deployment Technology Sample
  3. MSDN Walkthrough: Downloading Assemblies on Demand with the ClickOnce Deployment API Using the Designer

3 comments

  1. Hi,

    Nice article on a very important subject.

    We are a company that currently has an Access / SQL Server solution. There are abut 4000 total forms in our Utility Bill, Payroll, GL, AR, Permits, TAX, etc.. application.

    We have moved on the applications, Tax Assessment to ASP.NET 1.1 2 years ago.

    Until 4 weeks ago, we were going to move everything into ASP.NET 2.0 using AJAX.

    Then, I started investigating WPF. WOW! Best development tools and platorm I ever seeting in my 20 years of IT.

    Question : Is this possible as an XBAP? We know we can do this using the ClickOnce desktop deployment. We have tested deployments getting their data over a VPN (remote access) and next week I’ll add in getting the data over the Internet via Web Services.

    But we have some customers, who so some unknown reason, are stuck on a browser based product. I think it’s a lack of education.

    Would it be possible to have a huge application running as an XBAP? From what I can understand, the user would fire up their utility billing application, just getting the first screen or two, then as they click to look up a customer, view their bills, etc those portions of code could download.

    On things we have in our favor, is that most of our customers, would be sourcing their XBAP from the own Intranet server, so maybe this would run fast?

    Sorry for the rantings. Microsoft has provided excellent tools and given developers many choices.

    Do you know of any real world large appliations running as XBAP’s?

    Thank you and have a wonderful day

    Karl
    704-849-8242 ext 207

  2. HI I JUST LOOKING IN THE NET ,
    FOR XBAP CUSTOM CONTROL SAMPLE AND INFO.

    AND FIND ALMOST NOTHING.

    LIKE DOE’S CUSTOM CONTROL OF WPF/E & XBAP USING THE SAME INHERTED CLASS AND SO ON.
    THERE’S ANY WAY THAT MAYBE KAREN CAN WRITE A NICE ARTICLE ABOUT THE DIFFRENT OF CUSTOM CONTROL IN WPF/E VS XBAP.

    ALSO THERE NO XBAP ONLY !! ,FORUM AROUND.

    NICE ARTICLE.

    &

    10X ALOT.

    Guy.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>