如何使发行者策略文件重定向装配要求 [英] How to make Publisher Policy file redirect assembly request

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

问题描述

我已经创建工作公用库,它是我们的测试服务器上安装在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>

我是什么做错了吗?

What am I doing wrong?

澄清
我测试这个在我的本地dev的机器,因为开发商没有进入到测试服务器。

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

推荐答案

好吧......在刺...

Ok...at a stab...

1 - 你试图使用集绑定日志查看器(Fuslogvw.exe),看看有什么组件绑定发生?

1 - have you tried using the Assembly Binding Log Viewer (Fuslogvw.exe) to see what assembly binding is taking place?

您可以找到它:

C:\ Program Files文件\微软的SDK \的Windows \ v6.0A \ BIN \ FUSLOGVW.exe(安装VS2008)

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\FUSLOGVW.exe (with VS2008 installed).

2 - 我有共同的组装(其实有五人,但让保持简单)在网络驱动器 - 是网络驱动器上的两个组件居民

2 - "I have the common assembly (there are actually five, but lets keep it simple) on a network drive," - Are both assemblies resident on the network drive?

更新:确定......如果新的组件是网络驱动器上可能有一些的信任问题。您可以部署新的组件到服务器上的本地驱动器,然后重新安装到GAC?

Update: Ok...if the new assembly is on a network drive there are probably some trust issues. Can you deploy the new assemblies to a local drive on the server then re-install to the GAC?

UPDATE2:我know..stupid东西....你已经肯定了的公钥和版本号是否正确?即在新的装配您的AssemblyVersion属性绝对是1.1.0.0和公钥标记是一样的(在GAC)?

Update2: I know..stupid stuff....you have definitely got the publicKeyToken and version number correct? i.e. Your AssemblyVersion attribute for the new assembly is definitely 1.1.0.0 and the public key token is identical (in the GAC)?

你有没有试图消除​​文化attribue?

Have you tried removing the culture attribue?

UPDATE3:嗨最大....你能粘贴您使用的确切发布者策略文件?此外...请记住,如果你是从1.0到更高版本的组件重定向,发布策略名称必须使用你从重定向程序集的版本为major.minor命名。因此,在你的情况下,发布的政策应该被命名为policy.1.0.Leggett.Common.dll。我注意到你已经将它命名为policy.1.1.Leggett.Common.dll这可能是它不工作的原因。

Update3: Hi Max....Can you paste the exact publisher policy file you used? Also...remember that if you are redirecting from a 1.0 to a higher versioned assembly, the publisher policy name must be named using the major.minor version of the assembly you're redirecting from. So in your case the publisher policy should be named 'policy.1.0.Leggett.Common.dll'. I notice you've named it 'policy.1.1.Leggett.Common.dll' which may be the reason it's not working.

最后,你必须确保你所使用的1.0和1.1组件相同的密钥签署出版商策略。

And finally you must make sure you sign the publisher policy with the same key as used by the 1.0 and 1.1 assemblies.

我建了几个DLL的,并放弃他们在GAC然后用一个控制台应用程序在VS测试和它的工作:)

I built a couple of DLL's and dropped them in the GAC then used a console app in VS to test and it does work :)

UPDATE4:嗨马克斯,这是我从来没有想过。当你创建的发行策略文件,你指定的平台?试着用构建它:

Update4: Hi Max, something I never thought about. When you created the publisher policy file, did you specify the platform? Try building it with:

人/link:1.1.Leggett.Common.policy /out:policy.1.0.Leggett.Common.dll /密钥文件:/version:1.0.0.0

al /link:1.1.Leggett.Common.policy /out:policy.1.0.Leggett.Common.dll /keyfile: /version:1.0.0.0

离开了/平台切换,并明确指定版本号。

Leave out the /platform switch and explicitly specify the version number.

干杯
千电子伏

Cheers
Kev

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

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