.net - System.BadImageFormatException An attempt was made to load a program with an incorrect format -
i'm writing plug-in program based on public .net api. typically these plugins made creating class library dll references api assembly. command class created inheriting base command class in api assembly. application set reference plug-in dll file, , responsible firing custom command class when user requests it.
however, i'm trying automate code generation through system.codedom, , want create simple console application automatically generates new class types based off of types in api assembly.
yet, when try run application following exception.
system.badimageformatexception unhandled message: not load file or assembly 'revitapi, version=2011.0.0.0, culture=neutral, publickeytoken=null' or 1 of dependencies. attempt made load program incorrect format.
usually need set target framework of plug-in assembly 3.5. yet i've found error above goes away if set target framework of console application 2.0. however, console application references other class libraries of mine have target framework set 3.5. , i'd rather not rewrite them around 2.0 framework.
it's possibly 32 - 64 bits mismatch.
if you're running on 64-bit os, assembly revitapi may compiled 32-bit , process 64-bit or "any cpu".
or, revitapi compiled 64-bit , process compiled 32-bit or "any cpu" , running on 32-bit os.
Comments
Post a Comment