Could not load file or assembly 'X, Version=…' or one of its dependencies
The runtime couldn’t find or load a referenced DLL — missing from the output, wrong version, or wrong platform (x86/x64).
Could not load file or assemblyThe located assembly's manifest definition does not match Meaning
The assembly binder needs the exact referenced version (or a binding redirect on .NET Framework). Deployments missing a DLL, version conflicts between packages, and 32/64-bit mismatches are the classic causes.
Common causes
- DLL not copied to the output/publish folder
- Two packages require different versions (needs binding redirect on .NET Framework)
- x86/x64 mismatch (BadImageFormatException)
- Missing native dependency of a managed package
- Assembly blocked after download (Windows “Unblock”)
⚡ Quick fix
- Clean, restore and republish (
dotnet publish -c Release) - .NET Framework: enable AutoGenerateBindingRedirects
- Match the platform target to the native dependencies
- Check the fusion log for the exact probing failure
Detailed fix by platform
.NET
- .NET Framework: set
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>; use Fuslogvw.exe to see binding failures. .NET (Core): check*.deps.jsonand usedotnet list package --include-transitivefor conflicts.
How to diagnose
- Assembly — Which name and version?
- Output — Is the DLL in the publish folder?
- Versions — Conflicting package versions?
- Platform — x86 vs x64?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in .NET
- Unable to cast object of type System.InvalidCastException: Unable to cast object of type 'X' to type 'Y'
- NullReferenceException System.NullReferenceException: Object reference not set to an instance of an object
- Index was out of range ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 14 Oct 2026