Assembly Binding Redirect is a .NET mechanism allowing developers whose 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.


.NET Ignoring Assembly Binding Redirect

An example of such a configuration section can be seen below:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="myAssembly" publicKeyToken="1234abcd1234abcd"
          culture="neutral" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Though it just a simple configuration section, it’s hard for me to fix it 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, I finally figured it out.

I Just Edited into like this:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="myAssembly" PublicKeyToken="1234abcd1234abcd"
          culture="neutral" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

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.

Conclusion

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.

This may be a simple problem but you may got yourself frustrated for only one little mistake such a typo. Just a few lines in my example, but if you had a hundred of lines you don’t even want to make any mistake. How tiny is that.