Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding redirect fails - different publicKeyToken

I have an application that references this assembly in development environments:

name="Microsoft.Data.SqlXml" culture="neutral" publicKeyToken="89845dcd8080cc91" version="9.0.242.0"

However, live server contains old version of this library:

name="Microsoft.Data.SqlXml" culture="neutral" publicKeyToken="b77a5c561934e089" version="3.2.2917.0"

As you see publicKeyToken is different. I've added bindingRedirect to app.config:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Microsoft.Data.SqlXml" culture="neutral" publicKeyToken="89845dcd8080cc91" />
            <bindingRedirect oldVersion="9.0.242.0" newVersion="3.2.2917.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

but I still get the error:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'Microsoft.Data.SqlXml, Version=3.2.2917.0, Culture=neutral, PublicKeyToke n=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Data.SqlXml, Version=3.2.2917.0, Culture=neutral, PublicKe yToken=89845dcd8080cc91' ---> System.IO.FileNotFoundException: Could not load fi le or assembly 'Microsoft.Data.SqlXml, Version=9.0.242.0, Culture=neutral, Publi cKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find t he file specified. File name: 'Microsoft.Data.SqlXml, Version=9.0.242.0, Culture=neutral, PublicKey Token=89845dcd8080cc91'

Is there any way to redirect to older version of library in that case?

like image 412
dragonfly Avatar asked Oct 27 '11 08:10

dragonfly


1 Answers

You can't redirect an assembly if the public key is different I am afraid, you will need to recompile against the older version and remove the redirect.

like image 124
ChrisBint Avatar answered Oct 20 '22 14:10

ChrisBint