.Net Assembly Binding Redirect with Differing Public Key Tokens

本秂侑毒 提交于 2019-11-30 06:02:27
Mark Worth

No, it is not possible. The assemblies need to have the same publicKeyToken.

The bindingRedirect tag only has the oldVersion and newVersion attributes, so there's no way to tell it about the "null" version anyway.

But the real reason behind is explained due to the strong name mechanism

Don Kirkby

You might be able to use the AppDomain.AssemblyResolve event to do that. I've included some sample code in this answer.

mwardm

It does seem that a binding-redirect can't be used, but in my case I did manage to get around the problem with differing publicKeyTokens by amending the token-value being requested in the referencing DLL:

Disassemble the dll to IL, change reference, reassemble (and re-sign - which might be an issue if you don't have the keyfile).

(See my comment on when referencing assemblies, is it possible to insist on a version number but ignore the publickeytoken? (ie accept signed/unsigned) )

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!