如何发出发布者策略文件重定向程序集请求 [英] How to make Publisher Policy file redirect assembly request

查看:18
本文介绍了如何发出发布者策略文件重定向程序集请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工作中创建了一个公共库,它安装在我们测试服务器上的 GAC 中.我最近更新了它,我希望我们所有的应用程序都使用该更新.我创建了一个发布者策略程序集并将其与更新一起安装在 GAC 中,但是当 Web 应用加载 Leggett.Common, 1.0.0.0 时,它不会重定向到 Leggett.Common, 1.1.0.0.

I have created a common library at work, and it is installed in the GAC on our test server. I've recently updated it and I want all of our applications to be using the update. I created a publisher policy assembly and installed it in the GAC along with the update, but when a web app loads Leggett.Common, 1.0.0.0, it isn't redirected to Leggett.Common, 1.1.0.0.

我有一个网络驱动器上的公共程序集(实际上有五个,但让我们保持简单),我在它旁边创建了发布者策略 xml 文件,然后使用 al.exe 在同一个文件夹.之后,我将更新的程序集放入 GAC,然后将发布者策略程序集放入 GAC.

I have the common assembly (there are actually five, but lets keep it simple) on a network drive, I created the publisher policy xml file there next to it and then used al.exe to create the publisher policy assembly in the same folder. After that I put the updated assembly in the GAC and then put the publisher policy assembly in the GAC.

公共程序集为Leggett.Common.dll",发布者策略文件为1.1.Leggett.Common.policy",发布者策略程序集为policy.1.1.Leggett.Common.dll".

The common assembly is 'Leggett.Common.dll', the publisher policy file is '1.1.Leggett.Common.policy', and the publisher policy assembly is 'policy.1.1.Leggett.Common.dll'.

发布商政策文件的 XML 如下所示:

The XML for the publisher policy file looks like the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Leggett.Common"
                                  publicKeyToken="32cd8f1a53a4c744"
                                  culture="neutral" />
                <bindingRedirect oldVersion="1.0.0.0"
                                 newVersion="1.1.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

我做错了什么?

澄清
由于开发人员无权访问测试服务器,我正在我的本地开发机器上对此进行测试.

Clarification
I'm testing this on my local dev machine since developers don't have access to the test server.

推荐答案

您正确地识别了程序集,但是对于正在阅读的其他人,请通过 assemblyIdentity 元素中的根引用程序集,而不是文件扩展名(例如,Fubar"而不是Fubar.dll").

You're identifying the assembly correctly, but for anyone else who's reading, reference the assembly by its root in the assemblyIdentity element without the file extension (e.g., "Fubar" and not "Fubar.dll").

Microsoft 的 文档 忽略了... #$%#!(!@!

Microsoft's documentation neglects to mention that... #$%#!(!@!

这篇关于如何发出发布者策略文件重定向程序集请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆