Assembly Binding Redirect is a .NET mechanism allowing developers who’s application was compiled against a certain strongly-named assembly version to swap that assembly with a different version without recompiling the entire assembly. One of the methods for achieving this goal is by placing a special directive in the application’s configuration file, as described on MSDN.
.NET Ignores My Assembly Binding Redirect
An example of such a configuration section can be seen below:
Though it might be a simple configuration section, I found myself struggling quite a bit around such a section which for some reason did not appear to be having any effect on the .NET runtime’s behavior. After quite some time using the Assembly Binding Log Viewer trying to identify the issue, salvation has finally arrived – there was a typo!
My configuration, unfortunately, looked like this:
Can you spot the difference? The “p” in “publicKeyToken” was accidentally written as a capital letter, resulting in no errors thrown by the .NET framework, but plenty of frustration for me seeing that the above section does not do anything.
The .NET framework configuration is intolerant of typos on the one hand (the configuration won’t work) but it doesn’t warn you about it either. If something doesn’t work for no apparent reason, this is definitely a possible reason.
The best solution – when dealing with the .NET configuration, avoid typos! 🙂