Forcing the ASP.NET Application to load the assembly from bin not from GAC

后端 未结 8 1401
死守一世寂寞
死守一世寂寞 2020-12-15 21:18

Is there any way to force my asp.net application to load the assembly from local bin directory since there is another older version of the assembly with the same name in the

相关标签:
8条回答
  • 2020-12-15 22:10

    Change the version number, strong name the assembly and reference the strongly named higher version you deploy with your solution.

    0 讨论(0)
  • 2020-12-15 22:11

    The oldVersion configuration that is suggested by Muse VSExtensions works! You can use the strong name for the local assembly: Please look this page: http://msdn.microsoft.com/en-us/library/7wd6ex19.aspx

    Basically in web.config add something like:

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="DllName"
              publicKeyToken="0123456789abc"
              culture="neutral" />        
            <!-- Assembly versions can be redirected in app, 
              publisher policy, or machine configuration files. -->
            <bindingRedirect oldVersion="2.0.0.0-2.5.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>      
        </assemblyBinding>  
      </runtime>
    

    That way if i have an assembly in the gac that can be from version 2.0.0.0 to version 2.5.0.0 all the calls would be redirected to the newVersion (3.0.0.0)

    In the assemblies section I added the assembly:

    <add assembly="DllName, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0123456789abc" />
    

    And that's it.

    0 讨论(0)
提交回复
热议问题