解决一个项目里面加载两个同名不同版本的DLL的问题

在config里面这样配置,可以加载不同版本的dll

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.Prism.MefExtensions" culture="neutral" publicKeyToken="31bf3856ad364e35"></assemblyIdentity>
        <codeBase version="4.0.0.0" href="inms\Microsoft.Practices.Prism.MefExtensions.dll"></codeBase>
        <codeBase version="5.0.0.0" href="gip\Microsoft.Practices.Prism.MefExtensions.dll"></codeBase>   
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

下面的配置,可以指定旧的版本引用全部指向新版本

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.Prism.MefExtensions" culture="neutral" publicKeyToken="31bf3856ad364e35"></assemblyIdentity>
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"></bindingRedirect>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

 

posted @ 2016-06-03 16:14  改变你我  阅读(2010)  评论(0编辑  收藏  举报