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

Source: Internet
Author: User
Here is a small series to bring you a C # in the call DLL when the failure to load a file or assembly error processing method (detailed). Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.

When loading a DLL, the following exception occurred: Failed to load the file or assembly "DMC3000, version=1.0.0.0, culture=neutral, Publickeytoken=null" or one of its dependencies.

An attempt was made to load a program that is not properly formatted.

After the Internet query, the reason is x64 and x86 incompatibility problem. That is, the DLL is x64, but the target platform generated by the VS default is x86, so the inconsistency between the two causes the exception to occur.

The solution is as follows:

Project, Properties----target platform->x64 (consistent with DLL platform)

The above is the content of the processing method (in detail) that failed to load a file or assembly error when calling the DLL in C #, more about topic.alibabacloud.com (www.php.cn)!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.