System.IO.FileNotFoundException: Could not load file or assembly ‘X’ or one of its dependencies when deploying the application

… Could not load file or assembly ‘X’ or one of its dependencies

Most likely it fails to load another dependency.

you could try to check the dependencies with a dependency walker.

I.e: https://www.dependencywalker.com/

Also check your build configuration (x86 / 64)

Edit:
I also had this problem once when I was copying dlls in zip from a “untrusted” network share. The file was locked by Windows and the FileNotFoundException was raised.

See here: Detected DLLs that are from the internet and “blocked” by CASPOL

Leave a Comment

tech