OCR .NET Trial BadImageFormatException
Last Post 22 Feb 2014 04:23 PM by Devscope Helpdesk. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Devscope HelpdeskUser is Offline
New Member
New Member
Posts:16


--
22 Feb 2014 04:18 PM

    Hello,

    I'm using the trial version and run the project and when building it returns the following message.

    System.BadImageFormatException não foi manipulada
    Message: An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
    Additional information: Não foi possível carregar arquivo ou assembly 'DevScope.Ocr.Tesseract.x64, Version=1.5.0.0, Culture=neutral, PublicKeyToken=ef852b7f482fe968' ou uma de suas dependências. Foi feita uma tentativa de se carregar um programa com um formato incorreto.

    What is the problem?

    Devscope HelpdeskUser is Offline
    New Member
    New Member
    Posts:16


    --
    22 Feb 2014 04:23 PM

    The problem that you are refering, seems to be related with a bad setting in your visual studio project.
     
    The pair of DevScope.Ocr.Tesseract.xZZ dlls are compiled with diferent settings for each platform x86 or x64.
    This is a .NET limitation because those assemblies are compiled in native code and like so, each assembly must be target a specific platform. The only way you can use the same assembly for x86 or x64 is when that assembly is from c# or VB or any other .NET language.
     
    So, most probably your VStudio project targets "ANY CPU" on the build settings of the project properties and the compiler is deciding for x86 (because probably your Operating system is x86) and you are referencing the x64 dll, and thats why the error is BadFormatException.
     
    You need to make sure that you are targeting the correct platform.

    • If your project build settings is set to x86 you must reference the DevScope.Ocr.Tesseract.x86.DLL
    • If your project build settings is set to x64 you must reference the DevScope.Ocr.Tesseract.x64.DLL 
    • Try not to use the ANY CPU as vs will link references depending on the operation system platform.

     

     

    Hope this helps.
     
    Please feel free to contact support@devscope.net if you need any more help.

    You are not authorized to post a reply.