The smaller the XAP file, the quicker your application loads. Assembly caching in Silverlight 3 and 4 does exactly that. Let us understand what assembly caching is.
By default, when you deploy a Silverlight application, all the dependant assemblies get deployed in a single .xap file. So let us say if you have an application that uses System.XML.Serialization, System.ServiceModel.Syndication etc, then all these assemblies get deployed in a single .xap file. Shown below is a screenshot of the build process with all the assemblies added to a single .xap file.
This bulky .xap file when called by the Silverlight Plug-in from your browser, increases the application load time and if there are multiple application using the same assemblies, they cannot share the dll’s, that were already loaded earlier. What a waste!
However if you are using Silverlight 3 or above, you can make use of Assembly Caching which is a deployment mechanism to share common dll’s between applications as well as package dependant assembly outside the xap, there by keeping each .xap file small. It makes a lot of sense to cache these library assembles as they do not change so frequently. When the Silverlight app is first accessed by your browser, the plug-in downloads the .xap and all these external assemblies, and caches it. For each subsequent request, once the browser downloads the xap file, there’s no need to download the dependant assemblies, since they are already cached and can be reused instead. This also leads to sharing common dll’s between applications and reducing the app load time.
Enable Assembly Caching
To enable assembly caching in your Silverlight project, go to the Solution Explorer, select the Silverlight application project > Right Click > Properties > In the Silverlight tab, select Reduce XAP size by using application library caching. Save the settings.
Read more: DevCurry