Search code examples
oracleodp.netassemblyversions

How do I use a version of ODP.NET different to the one I built with?


I've got an app that is built with ODP.NET 2.111.6.20 - all the references in VS are set Specific Version to false, but when I try to run the app on a machine that only has 2.111.6.0, it throws an error saying it can't find the 2.111.6.20 assembly. How can I get my app to run with any version of ODP.NET 2.111?


Solution

  • I suppose the assembly is strongly signed, so you get the exception. You could use binding redirect in your app.config file:

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="ODP.NET"
                                  publicKeyToken="PUT THE PUBLIC TOKEN HERE"
                                  culture="neutral" />
                <bindingRedirect oldVersion="2.111.6.20"
                                 newVersion="2.111.6.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>