C # assembly redirection

I use Oracle.DataAccess and need access to the old database, which means that I need to use a slightly older version of this assembly. Both new and old builds are in the GAC, but I cannot force the application to use an 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 (like nothing, completely empty), but I'm not too familiar with this tool, so maybe I am using it incorrectly (too).

Any ideas?

+4
source share
2 answers

. 0.0.0.0-2.999.9.0. , dll Oracle, - () , .

, ? 2 Oracle.DataAccess .

<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>

MS https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element

+1

.

, . - , , , .

, LibraryX LibraryX LibraryY 1.0.

YourApp -> LibraryX (v3.2) -> LibraryY (v1.0)

2.0 LibraryY .

YourApp -> LibraryX (v3.2) -> LibraryY (v1.0)
        -> LibraryY (v2.0)

, LibraryY, LibraryX, .

, , LibraryX , YourApp.

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="LibraryY" publicKeyToken="89b483f429c4fecd"/>
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

:

YourApp -> LibraryX (v3.2) -> LibraryY (v2.0)
        -> LibraryY (v2.0)

, . , Oracle.DataAccess, .

.csproj :

<ItemGroup>
    <Reference Include="Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86">
        <SpecificVersion>True</SpecificVersion>
        <HintPath>C:\Windows\assembly\GAC_32\Oracle.DataAccess\2.121.1.0__89b483f429c47342\Oracle.DataAccess.dll</HintPath>
    </Reference>
<ItemGroup>

, , Oracle.DataAccess - GAC x86 x64, , processorArchitecture, HintPath , .

:

0

Source: https://habr.com/ru/post/1694767/


All Articles