How to reduce the size of the Silverlight xap package

Source: Internet
Author: User
This time, I got a chance to develop a Silverlight application. When I encountered a big problem with the xap package during the release, I went online for a long time and finally put Microsoft's document "how to use the application ". Program After reading the library cache for a long time, I finally figured out what it was saying. I was dizzy. It really took me the old saying "It's not difficult to come.

Finally, I decided to summarize this very simple thing to avoid wasting time on other new scholars.

Development scenario:

 

Silverlight application: interacts with the Web. Set Name: silverlightapplication10.dll

Silverlight Class Library: referenced by silverlightapplication10. Set Name: silverlightclasslibrary1.dll

Objectives:

In the compiled clientbin, The silverlightapplication10.xap package does not contain silverlightclasslibrary1.dll, And the silverlightclasslibrary1.dll exists independently in the new silverlightclasslibrary1.zip format.

OK. Now let's talk about this core trilogy:

1. In silverlighapplication10, the "Silverlight" label in the project property is checked with "reduce xap size by using application library Caching"

2. Add an extmap file "silverlightclasslibrary1.xml" to the location where the silverlightclasslibrary1.extmap. xml file is saved"

Content Description of silverlightclasslibrary1.extmap. xml

View sourceprint?
<? XML version = "1.0"?>
<Manifest xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xmlns: XSD = "http://www.w3.org/2001/XMLSchema">
<Assembly>
<Name> silverlightclasslibrary1 </Name>
<Version> 1.0.0.0 </version>
<Publickeytoken> ee6c3f173c1a51b5 </publickeytoken>
<Relpath> silverlightclasslibrary1.dll </relpath>
<Extension downloaduri = "silverlightclasslibrary1.zip"/>
</Assembly>
</Manifest>

Name: Assembly name of silverlightclasslibrary1

Version: assembly version.

Publickeytoken: Public Key after signature

There is nothing to explain. The Microsoft documentation "how to use the application library cache" clearly states. If you are not sure about version and publikeytoken, you can use the reflector command to check whether it is simple:

In addition, do not write an error in the content of extension downloaduri. It is the end of. Zip! I have a configuration for copy to. dll. I never succeeded. I thought I still need to set another configuration. I found it wrong only when I was killed.

3. silverlightapplication10 do not reference the silverlightclasslibrary1 project, but directly reference the compiled silverlightclasslibrary1.dll.

OK, the final result

Refreshing xap package! Change the secret name to silverlightapplication10.zip. Open it and see:

This site Article Except for the reprinted content, this site is original or translated. You are welcome to repost it in any form. However, please be sure to indicate the source and respect for others' labor achievements. Please note: The article is reprinted from: huide control network [http://www.evget.com/] address: http://www.evget.com/zh-CN/info/catalog/16004.html

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.