I\'m having a strange problem with deploying an application, which references an assembly, written in managed c++.
I\'ve created an assembly X, compiled it and refer
I had the same issue. For me it helped to remove the .vs directory in the project folder.
I also had the same issue when I tried to install a Windows service, in my case I managed to resolved the issue by removing blank spaces in the folder path to the service .exe, below is the command worked for me in a command prompt
cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
Press ENTER to change working directory
InstallUtil.exe C:\MyService\Release\ReminderService.exe
Press ENTER
... 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
I resolved this problem by renaming the DLL. The DLL had been manually renamed when it was uploaded to its shared location (a version number was appended to the file name). Removing the version number from the downloaded file resolved the issue.