C# and c++/cli problem on x86 OS
-
Hi, i made a library in c++/cli and beside a c# program calling it. Everything works fine when i compile on any cpu or x64 on my pc (x64os/x64proc). But if i compile for x86, c# part works fine, but when i use the c++/cli part i get the error "could not load file or assembly .... incorrect format" . I use user32.lib in the c++/cli, is it possible the problem come from here ? ---- Edit I think it's ok, i activated copy reference to output project but i'm not sure it was that.
-
Hi, i made a library in c++/cli and beside a c# program calling it. Everything works fine when i compile on any cpu or x64 on my pc (x64os/x64proc). But if i compile for x86, c# part works fine, but when i use the c++/cli part i get the error "could not load file or assembly .... incorrect format" . I use user32.lib in the c++/cli, is it possible the problem come from here ? ---- Edit I think it's ok, i activated copy reference to output project but i'm not sure it was that.
When you get a message like that, one project is compiling for either 32 or 64 bit and the other project is compiling for the opposite. If the target is "Any CPU", a project will compile so that if the code runs on a 64-bit machine, it'll run as a 64-bit process, and if on a 32-bit machine, as a 32-bit process. To solve this, make sure both projects build as either x64 or x86. Which depends on your requirements, but both projects have to build targeting the same thing.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak