Posts

Showing posts from November, 2015

Any CPU Type configuration in .NET project using C++ DLL

Any CPU Type configuration in .NET project using C++ DLL

Sometimes application is memory hungry like application for image processing etc. In this case we need a 64-bit OS where application can use higher amount of memory. Also we want that our application should remain compatible with 32-bit OS. To satisfy both these condition with single exe we can use Any CPU configuration to build our project.

Here are the steps to set Any CPU configuration open in Visual Studio -

1. Go to Build -> Configuration Manager
2. From Active solution platform click <New...>
3. From New Solution Platform select Any CPU
4. Click OK

Build the project. The exe created will be compatible on both OS (64-bit and 32-bit).

In case if we have a C++ dll used by the code and loaded at run-time as interop service. Since C++ project do not have Any CPU configuration, so in this case we build this C++ DLL in both configuration (64-bit and 32-bit) and then load DLL according to the type of system. Also we need…