Silverlight-reduces xap package volume

Source: Internet
Author: User

Remove unusedProgramSetItpub personal space & {l8k 'g % Ca
Visual Studio adds a lot of assembly by default after the SL application is created, and some may not be used at all.Itpub personal space qkx/g8ks "ou
Delete all the other files except the system reference, recompile the application, and add the missing DLL again. There are many errors that may be caused by adding a namespace reference. Here is a simple way to Remove unused namespaces (usingS), right-click a class name, then select organize usingS/Remove unused usingS.

Re-package the xap file "the smaller the better"Itpub personal space Ia @ ffk1q, m'z1a
We know that the xap package of Silverlight is essentially a standard ZIP package. There is an appmanifest in the package so that it can be correctly parsed when silverlgith is running. However, Visual Studio2008Xap is not compressed during packaging.Itpub personal space! Mm + M "awh + xvk
Here, we need to decompress the xap package in WinZip live WinRAR, compress the package, and change the extension to xap to replace the original file.

Place materials outside the SL Application
5l3f % h9l 'K dw0In the previous method, we used a sl application. However, when you build a sl application in the module, it is better to put the material file outside the Silverlight xap package. (Or put it in an external zip package and then compress it so that the SL application can obtain it dynamically. For more information, see "retrieve files from the zip package using Silverlight"Incomplete)
V? Mjo l) C0Use Assembly CacheItpub personal space 1c1a3o & z mt) m "QL
The method of using the Assembly Cache is simple. You only need to set the library caching to true on the SL attribute page.


'. L $ A + jm7reo0 (For more information, see "Silverlight custom Assembly Cache" Incomplete )

Dynamic Loading of xap
4 M % c u? Z-q {\ B0During Silverlight development, modules can be divided into multiple xap files, and a primary xap can be used to call other xap for dynamic loading.Itpub personal space # o0w Ne + XV + x
For example, let's take a look at the Photoshop website, which is completed using Flex technology.

We can see that their containers, class libraries, and styles are dynamically loaded.Itpub personal space ^ WD @
In Silverlight, you can use a simple loadingxap (For details, refer to "dynamically loading xap Files") or a third-party framework, for example, "managed extensibility framework" and "prism ".
N 'ap9h2wek0Here I use the prism framework to develop a project. Let's take a look at the results.

We can see that each module is loaded one by one.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.