Dynamically loading Silverlight XAPs
I have four Silverlight 4 apps, each in their own Visual Studio project, for which I want to write a "shell" to host them so they appear to the user as a single application. To minimize download times, I will download the XAPs and supporting DLLs dynamically. So I will end up with 5 apps - the shell and the four sub-apps. Now my problem:
My apps all reference the Telerik suite, and this is a fairly significant download. When I build my apps, the Telerik DLLs get zipped into each XAP (as expected). So even if I dynamically load the XAPs, the Telerik DLLs will be downloaded multiple times, once for each XAP.
So how do I make it so the Telerik DLLs are down开发者_运维技巧loaded only once (say, by the Shell), and shared by all the sub-applications?
If you go into the Properties window of your various Silverlight projects, and select the "Silverlight" tab, you'll see an option to "Reduce XAP size by using application library caching". If you select that, the support libraries (Telerik, in this case) will get packaged into separate .zip files that can be downloaded separately. See here for more details, including instructions on how to configure your own assemblies for this sort of behavior. (I presume, though I haven't checked, that Telerik has done this with their controls.)
精彩评论