Silverlight: how to handle standard assemblies

前端 未结 2 631
伪装坚强ぢ
伪装坚强ぢ 2021-01-17 04:26

A usual Silverlight task: to make the size of xap-file smaller. There are a lot of hot-to-do manuals that explain how to make your application modular. But I didn\'t find an

相关标签:
2条回答
  • 2021-01-17 04:55

    One suggestion is to use Silverlight's assembly file caching option. Documentation and an walkthru may be found here. The overall size of your application won't change, but it's likely that the end user experience, for returning users, will improve as the browser caches the individual assemblies.

    0 讨论(0)
  • 2021-01-17 05:10

    Typically, for larger, composite applications, you'd download a host application that takes the "hit" of the DLLs (i.e. if you are using x, y, and z, they will be included in the host). Another option is a lightweight introductory XAP, then download the additional ones in the background.

    Either way, the key is to strategize how your projects are related so that you only include the DLLs once. Once you have a XAP file that contains the necessary DLL, any other XAP loaded into the same application can set the reference to "copy-local=false". This means it will still reference System.Windows.Controls.Data.dll, for example, but won't actually keep a copy in the generate XAP.

    So again, if your desire is to reduce the footprint and load time of the initial, you might have: Application.xap that fires up and provides the user with navigation, splash screen, etc. It would instantally dynamically load "Libraries.xap" that contains the dependent DLLs (controls, etc) in the background, and finally any other "Module1.xap" and "Module2.xap" would simply reference the DLLs but have copy local set to false.

    I have an in-depth example with source code here: http://csharperimage.jeremylikness.com/2010/06/advanced-silverlight-applications-using.html

    0 讨论(0)
提交回复
热议问题