Binding redirection error - 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, the live server contains an old version of this library:

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

As you can see, publicKeyToken is different. I 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 insert paste "Microsoft.Data.SqlXml, Version = 3.2.2917.0, Culture = Neutral, PublicKeyToke n = 89845dcd8080cc91 'or one of its dependencies. The system cannot find the file File name: 'Microsoft.Data.SqlXml, Version = 3.2.2917.0, Culture = neutral, PublicKe yToken = 89845dcd8080cc91' ---> System.IO.FileNotFoundException: it is possible not to load the file or assembly "Microsoft.Data.SqlXml, Version = 9.0.242.0, Culture = neutral, Publi cKeyToken = 89845dcd8080cc91 'or one of its dependencies. The system cannot find the specified file. File name: 'Microsoft.Data.SqlXml, Version = 9.0.242.0, Culture = neutral, PublicKey Sign = 89845dcd8080cc91'

Is there a way to redirect to an older version of the library in this case?

+7
source share
1 answer

You cannot redirect the assembly if the public key is different. I'm afraid you will need to recompile the previous version and remove the redirect.

+8
source

All Articles