Home > Article > Backend Development > How to handle file or assembly error when calling DLL in C# (detailed explanation)
The following editor will bring you an article on how to handle the file or assembly error when calling a DLL in C# (detailed explanation). The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor to take a look
When loading the DLL, the following exception occurred: Failed to load file or assembly "DMC3000, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" or one of its dependencies.
Trying to load program with an incorrect format.
After checking online, the reason is the incompatibility between x64 and x86. That is, the DLL is x64, but the target platform generated by VS by default is x86. Therefore, the inconsistency between the two causes exceptions.
The solution is as follows:
Project->Properties->Build->Target Platform->x64 (with dll The platform is consistent)
The above is the content of the handling method of failing to load a file or assembly error when calling a DLL in C# (detailed explanation). For more related content, please pay attention to PHP Chinese Net (www.php.cn)!