How to optimize the size of silverlight XAP file by removing common files?

*爱你&永不变心* 提交于 2019-12-08 05:59:38

问题


I have bunch of common thrid party dlls that I use in multiple silver light projects. Each produce its own XAP files with same copy of the thrid party dlls. I would like to know, is it possibl to seperate the common thrid party dlls out and load only if the local cache dll is different from the common dll used by some other XAP that was previously loaded?

In other words, what I was thinking is, first time when I enter a new silverlight page, it would load the application XAp and the Common XAP file, from that silverlight app, I go to another silverlight page, which in turn loads another XAP but this time, it will not load the common dll XAP since it was already loaded by the first XAP load.

Thanks,


回答1:


I think a more optimal solution would be to try to minify your XAP/Zip files using something like ComponentOne XAPOptimizer. The problem with your approach is that you are introducing dependencies between projects that in no way could be managed if one or more projects change. This is a good resource for strategies to lower XAP file size.




回答2:


If the third-party DLL's are well done, they'll come with an .extmap.xml file that allows for precisely this scenario. But you need to turn it on by checking the "Reduce XAP size by using application library caching" option in your Silverlight project(s). See http://msdn.microsoft.com/en-us/library/dd833069(VS.95).aspx for more details about how this works.




回答3:


I believe that you have a main XAP which makes the calls to load the others XAPs, right? All you have to do is, in the properties of each DLL, change the atribute "Copy to Local" to FALSE, except on your main XAP. When the user download the main XAP, the DLL will be available to all dependents XAP.



来源:https://stackoverflow.com/questions/6048269/how-to-optimize-the-size-of-silverlight-xap-file-by-removing-common-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!