Unable to compile 64-bit assembly that contains OpenAccess ORM

3 posts, 0 answers
  1. Matt
    Matt avatar
    2 posts
    Member since:
    Jul 2013

    Posted 13 Aug 2013 Link to this post

    Hello,

    When I attempt to compile my assembly for a 64-bit platform I get the following error:

    The specified assembly [my dll] cannot be loaded.

    The problem might be that the enhancer runs in a .NET framework 2.0 vm and the assembly to enhance is a .NET 4.0 assembly
    or you are trying to enhance a x86 assembly in a 64 bit process or a x64 assembly in a 32 bit process.

    Please change the required version inside the enhancer.exe.config or venhance.exe.config or switch to 'Any CPU' for this project.


    I'm using VS2010 and OpenAccess ORM Q2 2013 SP1. I do not get this error when I compile for a 32-bit platform.  Does this mean that OpenAccess ORM cannot be used in a 64-bit assembly?

    In addition, 'Any CPU' is not an option I can use due to dependencies I need to use in my application.
  2. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 16 Aug 2013 Link to this post

    Hello Matt,

    The reason for this error message is that Visual Studio starts the MsBuild.exe as 32-bit process. In this context the Enhancer.exe is being executed and it loads your assembly in order to obtain the metadata and inject the code needed to make your entities persistence capable. Your assembly is compiled as x64 and it cannot be loaded in 32-bit process. This issue appears only compile time. 

    To avoid this problem I would suggest you to move you data access layer (the entity classes and the OpenAccess Context) in separate project. This project you can compile as Any CPU. It will be enhanced correctly and later you can reference if from any project, regardless its platform (x32, x64 or Any CPU). Runtime OpenAccess ORM can work both in 32-bit and  64-bit processes.

    I hope this helps. Please do not hesitate to get back to us if you have any other questions.
     

    Regards,
    Kaloyan Nikolov
    Telerik
    OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
  3. DevCraft banner
  4. Matt
    Matt avatar
    2 posts
    Member since:
    Jul 2013

    Posted 16 Aug 2013 Link to this post

    Thank you for the explanation!  Your suggestion solved my issue perfectly.
Back to Top