Looking inside Silverlight XAP Files, and Making Them Smaller
The unit of deployment in Silverlight is a XAP file. This file contains the manifest and all of the code necessary to run a Silverlight application. The file format itself is nothing special, it is just a ZIP file with a different name. Inside it you can find an AppManifest.xaml file and any necessary DLLs.
Unfortunately, the included DLLs often contain a lot of unnecessary code. If your application only needs a small part of a library, your download size could be unnecessary large. Rather than using a new project file for each application, you can remove the unused classes after the fact using XapOptimizer.
XapOptimizer, currently in beta, is an online tool from ComponentOne. You can upload XAP files, which are purged of unnecessary code and then emailed back to you. For the purpose of this article I grabbed a couple of random XAP files I had in my web browser cache and got back an average reduction of 27%. Checking with Reflector, it did in fact strip out several types from the DLLs.
Stephanie Davis (nee Stewart) Dec 21, 2014