Search code examples
c#.netc++-climixed-mode

Managed code references between any cpu and x64


I have a mixed-mode C++/CLI project which is compiled as x86 and x64 frozen dlls.

I have a C# app that needs to use this project which is compiled as "Any CPU". How can I properly reference the correct dll from the c# app? If I right click add reference I must select only 1 of the 2 dlls.
My "ANY CPU" C# app will sometimes run as x64 and sometimes as x86 process.

I've heard you can maybe do this via a smart config file.


Solution

  • Even if your C++ project compiles twice it should have the same managed interface for both x86 and x64 DLL's. Hence as long as your not using strong name signing it shouldn't matter which version of the DLL you reference. What's important is that the correct version is deployed on the target machine.