开发者

Silverlight: how to handle standard assemblies (part 3)

When Silverlight4 application is build the 'Microsoft.Practices.Unity.Silverlight.dll' assembly is not putting into a separated file zip-file, it is in the XAP-file instead.

To be consistent, here are links to previous questions of the 'How to handle standard assemblies' topic: [Silverlight: how to handle standard assemblies: how to handle standard assemblies] [Silverlight: how to handle standard assemblies (part 2): how to handle standard assemblies (part 2)]

Here is a list of actions done:

  1. Deleted references on 'Microsoft.Practices.Unity.Silverlight.dll' assembly from Silverlight project and all its libraries;
  2. Copied this dll into "C:\Project\DLL" folder;
  3. "Microsoft.Practices.Unity.Silverlight.extmap.xml" file was created in the folder with the following content:

    < ?xml version="1.0"?>

    <manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <assembly>
        <name>Microsoft.Practices.Unity.Silverlight</name>
        <version>2.0.414.0</version>
        <publickeytoken>31bf3856ad364e35&l开发者_如何转开发t;/publickeytoken>
        <relpath>Microsoft.Practices.Unity.Silverlight.dll</relpath>
        <extension downloadUri="Microsoft.Practices.Unity.Silverlight.zip" />
      </assembly>
    </manifest>
    

(version number and public key token get from assembly itself).

  1. Added reference to the assembly into Silverlight project and 1 Silverlight class library that is used by the project;
  2. Performed full rebuild of the Silverlight-projects, rebuilded a web-site.

I am expecting file "Microsoft.Practices.Unity.Silverlight.zip" to be appeared in the "ClientBin" folder of the web site... but it doesn't.. And I don't have any idea why..

Probably you know something helpful? If so, please let me know.

Thank you!


I downloaded and installed the Unity Framework 2.0.

I added two files to the default installation folder.

C:\Program Files (x86)\Microsoft Unity Application Block 2.0 for Silverlight\Bin

Microsoft.Practices.Unity.Silverlight.extmap.xml:

<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <assembly>
    <name>Microsoft.Practices.Unity.Silverlight</name>
    <version>2.0.414.0</version>
    <publickeytoken>31bf3856ad364e35</publickeytoken>
    <relpath>Microsoft.Practices.Unity.Silverlight.dll</relpath>
    <extension downloadUri="Microsoft.Practices.Unity.Silverlight.zip" />
  </assembly>
</manifest>

and Microsoft.Practices.ServiceLocation.extmap.xml:

<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <assembly>
    <name>Microsoft.Practices.ServiceLocation</name>
    <version>2.0.414.0</version>
    <publickeytoken>31bf3856ad364e35</publickeytoken>
    <relpath>Microsoft.Practices.ServiceLocation.dll</relpath>
    <extension downloadUri="Microsoft.Practices.Unity.Silverlight.zip" />
  </assembly>
</manifest>

I've never used the Unity Framework, so I decided that I'd want to include both assemblies in the same ZIP file. To do that I set the downloadUri attribute of the extension element to be the same file name in both extmap.xml files. In this case, I used Microsoft.Practices.Unity.Silverlight.zip.

I added a reference to the Microsoft.Practices.Unity.Silverlight assembly from a Silverlight 4.0 project.

Next, I checked the option: Reduce XAP size by using application library caching in the project properties of my Silverlight project.

Rebuilt the solution. Within the ClientBin folder of the host web application, a new Zip file Microsoft.Practices.Unity.Silverlight.zip had been added after the rebuild.

I'd suggest following the method I used and see if that works for you. Try rebuilding the solution with that option unchecked (and clear the client bin folder). Clean, and rebuild with it checked and see if that has any effect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜