Being Silverlight developer means that we are also kind of web developers. From this point of view, we also have to think about the web traffic that our applications generate. We need to reduce it as much as possible. So basically we need to reduce the size of the application's output - the .xap file.
In this post I'll try to summarize the five ways to reduce the size of a xap that I've shared today with Sofia's Silverlight User Group.
In order to reduce the size of a xap file, we should first be aware of its structure. Basically it can contain only 4 things:
So we can smaller its size by reducing the code and resources of our assemblies, load assemblies on demand (exclude them from the xap) or minify some of the compiled library assemblies.
You should carefully think about the resources (Images, Videos...) - how you use and manage them! You have 3 options to choose from - embed them into assembly, add them as a content in the xap or leave them on the server as web content. Note that the last option can reduce the xap significantly. You have to check their "Build Action" and choose the correct one:
Thank you for your time and keep in mind that the Xap size matters!
Miro Miroslavov is XAML enthusiast. You can follow him on Twitter at @mmiroslavov.