Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# assembly redirection

I am using Oracle.DataAccess, and need to access an older database, which means I need to use a bit older version of this assembly. Both the new and old assemblies are in the GAC, but I cannot seem to get the application to use the older version. Here is my .config file:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342"/>
        <bindingRedirect oldVersion="2.121.1.0" newVersion="2.112.3.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

fuslogvw shows nothing (as in nothing, completely empty), but I am not too familiar with this tool, so maybe I'm using that wrong (too).

Any ideas?

like image 803
jjespersen Avatar asked Feb 14 '26 22:02

jjespersen


1 Answers

Your config file looks right. But I would change the old version to this 0.0.0.0-2.999.9.0. Because then you don't really care what the actual version of the Oracle dll is and new version is the correct (Old) version you want to work with.

Now are you sure this is the correct version? The version 2 of Oracle.DataAccess is frightfully old.

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342"/>
        <bindingRedirect oldVersion="0.0.0.0-2.999.9.0" newVersion="2.112.3.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

And here is some more info from MS https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element

like image 149
Archlight Avatar answered Feb 17 '26 12:02

Archlight



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!