Assembly binding redirect does not work
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When an assembly binding redirect in app.config or web.config does not work, the most common causes are: the redirect is in the wrong config file, the publicKeyToken is missing or wrong, the newVersion does not match the actual assembly on disk, or AutoGenerateBindingRedirects is overwriting your manual redirect. Diagnosing requires the Fusion Log Viewer (fuslogvw.exe) to see exactly what the CLR is loading and why it rejects the binding.
A Correct Binding Redirect
Every part matters: name, publicKeyToken, culture, oldVersion range, and newVersion must all be correct.
Cause 1: Wrong Config File
The CLR reads the config of the entry-point assembly (the .exe or web app), not library projects.
Cause 2: Wrong publicKeyToken
If publicKeyToken is wrong or missing, the redirect silently does nothing. The token must match the assembly's strong name exactly.
Cause 3: newVersion Does Not Match the DLL
Note: the NuGet package version (e.g., 13.0.3) is NOT the assembly version (13.0.0.0). Always check the actual assembly version.
Cause 4: AutoGenerateBindingRedirects Overwrites
When enabled, MSBuild generates binding redirects during build, potentially overwriting your manual edits in the output config. Check bin/Debug/MyApp.exe.config — it may differ from your source app.config.
Fix: either rely entirely on auto-generation (recommended) or disable it and manage redirects manually.
Cause 5: Missing xmlns Attribute
The xmlns="urn:schemas-v1:asm.v1" attribute is mandatory. Without it, the entire assemblyBinding section is silently ignored.
Diagnosing with Fusion Log
The Fusion log shows:
- Which version was requested
- Which config file was read
- Whether a binding redirect was applied
- Which path the assembly was loaded from (or why it failed)
Cause 6: GAC Assembly Takes Priority
The CLR checks the GAC before local paths. A GAC-installed assembly ignores binding redirects from app.config.
Checklist for Debugging
Common Pitfalls
- Editing the wrong config file: For web apps, edit
web.config. For console apps, editapp.config(notMyApp.exe.configin the bin folder — that gets overwritten on build). For test projects, edit the test project'sapp.config. - Missing
xmlnsonassemblyBinding: Withoutxmlns="urn:schemas-v1:asm.v1", the entire binding section is silently ignored. This is the most frustrating issue because there is no error — the redirect simply does not apply. - Confusing NuGet version with assembly version: NuGet package
Newtonsoft.Json 13.0.3has assembly version13.0.0.0. The binding redirect uses assembly versions, not package versions. - Multiple
assemblyBindingelements: Having two<assemblyBinding>elements in the same config causes the second to be ignored. Merge all<dependentAssembly>entries under a single<assemblyBinding>element. - Config transforms removing redirects:
web.Release.configtransforms may usexdt:Transform="Remove"on binding elements. The development config works but the published config does not. Check the transformed output.
Summary
- Binding redirects must be in the entry-point project's config (exe or web app, not class library)
- The
xmlns="urn:schemas-v1:asm.v1"attribute is required — without it, redirects are silently ignored newVersionmust match the assembly version on disk, not the NuGet package version- Use
sn -T assembly.dllto find the correctpublicKeyToken - Enable Fusion logging (
fuslogvw.exe) to see exactly why a binding fails - Use
AutoGenerateBindingRedirectsto let MSBuild handle redirects automatically

