[Solved] BadImageFormatException

Home Forums Software Development [Solved] BadImageFormatException

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6944
    Blair
    Participant

    I am attempting my first program using the Tobii .NET API. I followed the directions in the developer’s guide for adding references. (copied the EyeXFramework project into my project folder and added as existing project, copied Tobii.EyeX.Client.dll into my project folder and changed the properties, added references to EyeXFramework.dll and Tobii.EyeX.Client.Net20.dll, selected x64 before running) My program recognizes the EyeXHost object. It runs fine with the line “private EyeXHost eyeXHost;” The samples also run without exception.

    When I try to run the line “eyeXHost = new EyeXHost();” in my program I get the exception “BadImageFormatException: Could not load file or assembly ‘EyeXFramework, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”

    The only information I could find about this error said it is caused by a mismatch in the bit type. I recopied in the DLLs from the x64 folder and tried running my program as x86 but neither worked. Please let me know if anything else can cause this error.

    #6957
    Grant [Tobii]
    Keymaster

    Hi @blair, I believe this is still a problem with the DLL’s not having the right bitness. Did you by chance know about the tutorial we have written for getting started available @

    Walkthrough: setting up a C/C++ project for the EyeX C API

    Although the arhitecture is different, I still think following this guide would be good way to ensure the proper procedure is followed. Please get back to us if you still have problems.

    #6959
    Blair
    Participant

    It turned out the issue was the “Prefer 32-Bit” setting in project properties.

    #6961
    Grant [Tobii]
    Keymaster

    Hi @blair, cool thanks for getting back to us and letting us know the origin of the problem .. Happy coding!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.