none
BindingRedirect RRS feed

  • Question

  • Hello,

    I have visual studio 2010 running on windows server 2008 x64 with ODAC x64 11g with the version 4 of the .Net framework.

    I have a home made dll (build any CPU) that reference Oracle.DataAccess version 2.102.2.20 wich is x86 and I can not modify this dll.

    This should not be a problem but the bindingredirect does not work

    This is the redirect I try

     <configuration>
        <runtime>
           <assemblyBinding xmls="urn:schemas-microsoft-com:asm.v1">
            <dependantAssembly>
                    <assemblyIdentity name="Oracle.DataAccess"   publicKeyToken="89b483f429c47342" /> 
                    <bindingRedirect oldVersion="2.102.2.20" newVersion="2.111.6.0" />
              </dependantAssembly>
           </assemblyBinding>
       </runtime>
    </configuration>
    And this is the error in VS 2010
    Reference required to assembly 'Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342' containing the type 'Oracle.DataAccess.Client.OracleConnection'. Add one to your project.

    I have tried targetting fx2, 3.5 and 4 with the same result.
    I have tried to put the redirect in all machine.config and got the same error.
    I have tried with a linkedconfiguration file and got the same error.

    What am I missing ?

    Thanks

    Sylvain


    Sylvain
    Tuesday, June 22, 2010 7:36 PM

Answers

  • Have you added v2.102.2.20 reference in your project? Once your exe is compiled with this version and then you can redirect it with new version.


    Regards
    Nayan Paregi (MCTS)
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by SamAgain Wednesday, June 30, 2010 7:09 AM
    Wednesday, June 23, 2010 3:15 AM
  • Hi,

      As the error meesgae said, your program used the type 'Oracle.DataAccess.Client.OracleConnection', so a reference to the assembly 'Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342' is needed, which contains that type. It's caused by a missing assembly reference, not the redirection fault.


    Please mark the right answer at right time.
    Thanks,
    Sam
    • Marked as answer by SamAgain Wednesday, June 30, 2010 7:14 AM
    Wednesday, June 30, 2010 7:14 AM

All replies

  • Have you added v2.102.2.20 reference in your project? Once your exe is compiled with this version and then you can redirect it with new version.


    Regards
    Nayan Paregi (MCTS)
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by SamAgain Wednesday, June 30, 2010 7:09 AM
    Wednesday, June 23, 2010 3:15 AM
  • Hi,

      As the error meesgae said, your program used the type 'Oracle.DataAccess.Client.OracleConnection', so a reference to the assembly 'Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342' is needed, which contains that type. It's caused by a missing assembly reference, not the redirection fault.


    Please mark the right answer at right time.
    Thanks,
    Sam
    • Marked as answer by SamAgain Wednesday, June 30, 2010 7:14 AM
    Wednesday, June 30, 2010 7:14 AM
  • Hello Nayan,

    Sorry for the delay.

    Indeed doing this worked. I thought .Net was brilliant enough to perform the redirect without needing to add an old unused refence to a project !

    But now I have another question.
    Oracle has put a publisher policy into the GAC that has precedance over my redirection.

    Here is the log of fusion log viewer :

    LOG: Publisher policy file is found at C:\Windows\assembly\GAC_64\Policy.2.102.Oracle.DataAccess\2.111.6.0__89b483f429c47342\Policy.2.102.Oracle.DataAccess.config.
    LOG: Publisher policy file redirect is found: 2.102.2.20 redirected to 2.111.6.0.
    LOG: ProcessorArchitecture is locked to AMD64.
    LOG: Post-policy reference: Oracle.DataAccess, Version=2.111.6.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
    LOG: Found assembly by looking in the GAC.

    I tried to override that with the <publisherPolicy apply="no"/> element but it is not working. The CLR always load the dll of the publisher policy  file. I tried to put the config in the machine.config in case that the CLR does not allow to do this at the application level but still not working.

    Any ideas ?


    Sylvain
    Friday, July 2, 2010 2:43 PM