How to: Load Prism modules packaged in a separate XAP file in an OOB application

I have seen many questions, both in the Codeplex  (here) and StackOverflow forums (here), asking how to load modules that were packaged for remote module loading in a Silverlight out of browser application.

I created this sample a couple of months ago, and I thought might be useful for others. Here you can download the sample I put together using the Modularity QS from Prism 4. You can also download the necessary files separately (OOBModuleManager.cs and CachingXapModuleTypeLoader.cs)

The following are the highlights and steps to follow to run the sample:

  1. Open the solution is under PrismV4\Quickstarts\Modularity\Silverlight\ModularityWithUnity.
  2. Make sure the Web Site project is set as startup project.
  3. Open the CachingXapModuleTypeLoader and OOBModuleManager to see how they work. Also check out how the OOBModuleManager is registered in the Bootstrapper's ConfigureContainer method.
  4. Run the application. Load all 6 modules.
  5. Install the application (add to Desktop and Start Menu).
  6. Close web browser and OOB window.
  7. Check in Systray that http://localhost:portX is not running. If it is, stop the site.
  8. Open OOB App from desktop.
  9. Load modules, they should load correctly.

image001

Note: Modules B, D, E & F are loaded remotely, in background, not from main xap or however the Prism docs are explaining it (if you open Iso Storage you’ll find the .xap files there).

I hope this is useful for you in case you are required to implement this scenario.