zoukankan      html  css  js  c++  java
  • .net解决程序集版本冲突的方法

    以log4net为例,分为两种情况

    1.不同version,相同publicKeyToken

    在bin里放较新版本的dll

    并在web|app.config的<configuration>下放

    <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <dependentAssembly>
                    <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" />
                    <bindingRedirect oldVersion="0.0.0.0-1.2.10.0"
                                     newVersion="1.2.11.0"/>
                </dependentAssembly>
            </assemblyBinding>
        </runtime>
    

    2.不同version,不同publicKeyToken

    在bin里创建不同版本的文件夹,并放入对应版本的dll

    并在

    web.config的<configuration>下放

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="log4net" publicKeyToken="681549d62126b7b8" />
            <codeBase version="1.2.9.0" href="bin/log4net1.2.9.0/log4net1.2.9.0.dll" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" />
              <codeBase version="1.2.10.0" href="bin/log4net1.2.10.0/log4net1.2.10.0.dll" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" />
              <codeBase version="1.2.11.0" href="bin/log4net1.2.11.0/log4net1.2.11.0.dll" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    

    或者

    app.config的<configuration>下放

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="log4net" publicKeyToken="681549d62126b7b8" />
            <codeBase version="1.2.9.0" href="log4net1.2.9.0/log4net1.2.9.0.dll" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" />
              <codeBase version="1.2.10.0" href="log4net1.2.10.0/log4net1.2.10.0.dll" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" />
              <codeBase version="1.2.11.0" href="log4net1.2.11.0/log4net1.2.11.0.dll" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
  • 相关阅读:
    《命运赋》
    CSS3中的 transform (变形)+Transition(转换) = animation(动画)
    c#进阶之泛型
    正则表达式运用
    查询某时间段的统计数据
    很好用的request转换为实体方法还有判断实体所有参数不能为空的方法
    http 协议集合,超级简单
    今天无意发现jquery的一个以前的误导
    IFRAM随内部长宽高变化
    就最近学习MVC4.0的页面用法学到的东西
  • 原文地址:https://www.cnblogs.com/FoChen/p/4570990.html
Copyright © 2011-2022 走看看