将策略文件添加到GAC时出错 [英] Error adding policy file to GAC

查看:163
本文介绍了将策略文件添加到GAC时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照此

I'm trying to add a publisher policy file to the gac as per this thread but I'm having problems when I try and add the file on my test server.

我得到找不到程序集'policy.3.0.assemblyname.dll'的清单中指定的模块"

I get "A module specified in the manifest of assembly 'policy.3.0.assemblyname.dll' could not be found"

我的策略文件如下:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="*assemblyname*"
                          publicKeyToken="7a19eec6f55e2f84"
                          culture="neutral" />
        <bindingRedirect oldVersion="3.0.0.0"
                         newVersion="3.0.0.1"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

请帮助!

谢谢

我已经使用新的程序集重新创建了该问题,该程序集本身没有依赖关系(除了默认值)-都可以在我的本地开发计算机上正常工作(并且也可以重定向),但是在添加策略文件时出现相同的错误到服务器上的GAC!

I've recreated the problem from scratch with a new assembly that has no dependancies (apart from the defaults) itself - all works fine on my local development machine (and redirects fine too) but gives the same error adding the policy file to the GAC on the server!

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="TestAsm"
                          publicKeyToken="5f55456fdcc9b528"
                          culture="neutral" />
        <bindingRedirect oldVersion="3.0.0.0"
                         newVersion="3.0.0.1"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

通过以下方式链接

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\al.exe /link:PublisherPolicy.xml /out:policy.3.0.TestAsm.dll /keyfile:..\..\key.snk /version:3.0.0.0
pause

请帮助!

推荐答案

哇-知道了.

我应该更加注意这到底是什么意思

I should have paid more attention to exactly what this meant

(MSDN)如何:创建发布者策略

重要说明:发布者政策 程序集无法添加到全局 程序集缓存,除非原始 发布者政策文件位于 与程序集相同的目录.

Important Note: The publisher policy assembly cannot be added to the global assembly cache unless the original publisher policy file is located in the same directory as the assembly .

坦率地说,这个要求是如此奇怪,以至于它没有被注册.当您添加策略程序集时,原始策略文件(已编译到我要添加到gac的程序集中)必须与策略程序集位于同一文件夹中.

That requirement is, frankly, so bizarre that it didn't register. The original policy file, that was compiled into the assembly i'm trying to add to the gac, has to be in the same folder as the policy assembly as you add the policy assembly.

这篇关于将策略文件添加到GAC时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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