结合在.net中的重定向问题 [英] Binding redirect problem in .net

查看:177
本文介绍了结合在.net中的重定向问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类库称为MyAssembly程序在内部参考A.DLL,B.DLL的3.1.1.0版本;我有建造一所输出的MyAssembly.dll程序项目。在不同的系统(盒)我创建了一个Web应用程序项目和参考MyAssembly.dll程序。新系统具有A.DLL和B.DLL 4.0.0的新版本;我用结合在web.config中重定向如下图所示。但仍无法编译Web应用程序。它说,丢失的装配参考A.DLL,版本3.1.1.0。

I have a class library called "MyAssembly" that is internally referencing a.dll, b.dll of version 3.1.1.0; I have build the project which outputed MyAssembly.dll. On a different system (box) I have created a web application project and referenced the MyAssembly.dll. the new system has new versions of a.dll and b.dll 4.0.0; I used binding redirect in web.config like below. But still unable to compile the web application. it says missing assembly reference a.dll, version 3.1.1.0.

能够在解决这一问题的任何机构帮助?

Could any body help in solving this issue?

谢谢,
苏雷什

Thanks, Suresh


      
        
        
      
      
        
        
      
    

推荐答案

这完全为我工作。注意:您需要在配置标签没有命名空间。你必须对你的 assemblyBinding 标签的命名空间。

This totally worked for me. NOTE: You need NO namespace on the configuration tag. And you MUST have a namespace on your assemblyBinding tag.

< assemblyBinding>元素<&运行GT;

<!-- important: no namespace -->
<configuration> 
  <runtime>
    <!-- important, must have this namespace -->
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
      <dependentAssembly>
        <assemblyIdentity name="Strongly.Named.Assembly" publicKeyToken="xxx" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

做这两个的,否则也不会读它。如果它是给它不能在这个例子中装载任何东西,但2.0.0.0错误,那么它不正确拿起配置元素。

Do both of those or else it will not read it. If it is giving an error that it cannot load anything but 2.0.0.0 in this example, then it is not picking up the config elements properly.

这也只能在强命名程序集。要查出是否有强烈命名从VC命令窗口中运行以下命令

This also only works on strongly named assemblies. To find out if something is strongly named run the following command from the VC command window

打开(开始菜单>所有程序>的Visual Studio> Visual Studio工具> Visual Studio命令提示符)

open (start menu > all programs > visual studio > visual studio tools > visual studio command prompt)

然后运行:

sn -vf "path-to-assembly.dll"

如果它返回它是有效的,那么它的强命名。

If it returns that it is valid, then it's strongly named.

来源:
<一href=\"http://blog.codingoutloud.com/2010/03/13/three-ways-to-tell-whether-an-assembly-dl-is-strong-named/\" rel=\"nofollow\">http://blog.codingoutloud.com/2010/03/13/three-ways-to-tell-whether-an-assembly-dl-is-strong-named/

这篇关于结合在.net中的重定向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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