FileNotFoundException assembly 🟪 .NET

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).

Seen on: .NET Windows

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

  1. Clean, restore and republish (dotnet publish -c Release)
  2. .NET Framework: enable AutoGenerateBindingRedirects
  3. Match the platform target to the native dependencies
  4. Check the fusion log for the exact probing failure

Detailed fix by platform

.NET

  1. .NET Framework: set <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>; use Fuslogvw.exe to see binding failures. .NET (Core): check *.deps.json and use dotnet list package --include-transitive for conflicts.

How to diagnose

  1. Assembly — Which name and version?
  2. Output — Is the DLL in the publish folder?
  3. Versions — Conflicting package versions?
  4. Platform — x86 vs x64?

🧠 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.