Home  >  Article  >  Backend Development  >  How to handle file or assembly error when calling DLL in C# (detailed explanation)

How to handle file or assembly error when calling DLL in C# (detailed explanation)

黄舟
黄舟Original
2017-03-07 11:18:413572browse

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 (m.sbmmt.com)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn