Silverlight:如何处理标准程序集(第 3 部分)

发布于 2024-09-12 19:13:11 字数 1561 浏览 4 评论 0原文

当构建 Silverlight4 应用程序时,“Microsoft.Practices.Unity.Silverlight.dll”程序集不会放入单独的 zip 文件中,而是放入 XAP 文件中。

为了保持一致,以下是“如何处理标准程序集”主题之前问题的链接: [Silverlight:如何处理标准程序集:如何处理标准组件] [Silverlight:如何处理标准程序集(第 2 部分)< /a>:如何处理标准程序集(第 2 部分)]

以下是已完成操作的列表:

  1. 从 Silverlight 项目及其所有库中删除了对“Microsoft.Practices.Unity.Silverlight.dll”程序集的引用;
  2. 将此 dll 复制到“C:\Project\DLL”文件夹中;
  3. “Microsoft.Practices.Unity.Silverlight.extmap.xml”文件已在文件夹中创建,内容如下:

    < ?xml 版本=“1.0”?>

    <块引用>
    
      <组装>
        <名称>Microsoft.Practices.Unity.Silverlight
        <版本>2.0.414.0
        31bf3856ad364e35
        Microsoft.Practices.Unity.Silverlight.dll
        >
      
    
    

(版本号和公钥令牌从程序集本身获取)。

  1. 添加了对 Silverlight 项目中程序集的引用以及项目使用的 1 个 Silverlight 类库;
  2. 执行了 Silverlight 项目的全面重建,重建了网站。

我期望文件“Microsoft.Practices.Unity.Silverlight.zip”出现在网站的“ClientBin”文件夹中......但它没有......而且我不知道为什么......

可能你知道一些有用的东西吗?如果是这样,请告诉我。

谢谢你!

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</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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提笔落墨 2024-09-19 19:13:12

我下载并安装了 Unity Framework 2.0

我在默认安装文件夹中添加了两个文件。

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>

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>

我从未使用过Unity框架,所以我决定我想将这两个程序集包含在同一个 ZIP 文件中。为此,我将两个 extmap.xml 文件中 extension 元素的 downloadUri 属性设置为相同的文件名。在本例中,我使用了 Microsoft.Practices.Unity.Silverlight.zip

我添加了对 Silverlight 4.0 项目中的 Microsoft.Practices.Unity.Silverlight 程序集的引用。

接下来,我在 Silverlight 项目的项目属性中选中了选项:通过使用应用程序库缓存减少 XAP 大小

重建解决方案。在主机 Web 应用程序的 ClientBin 文件夹中,重建后添加了一个新的 Zip 文件 Microsoft.Practices.Unity.Silverlight.zip。

我建议您按照我使用的方法进行操作,看看是否适合您。尝试在未选中该选项的情况下重建解决方案(并清除客户端 bin 文件夹)。清理并重建并检查,看看是否有任何效果。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文