how to build 64 bit managed c++ dll in visual studio 2010?

5.2k Views Asked by At

I've got a managed c++ dll, and it builds fine in x86 format. However, when I change the format to x64 in configuration manager, it won't recognize .Net namespaces, like System etc.

What else should I change to be able to build the 64-bit version of the app?

I'll need to be able to build the app for x64 and for x86.

2

There are 2 best solutions below

3
On BEST ANSWER

When you changed your project to target x64, the settings that tell the compiler to target the .NET Framework obviously didn't get transferred over.

Check your project's properties to ensure that all of the x64 settings match with the x86 settings.

More specifically, you're looking for the "Common Language Runtime Support" property. On recent versions of Visual Studio, this should probably be set to Common Language Runtime Support, Old Syntax (/clr:oldSyntax) for Managed C++.

  

3
On

You would create an 'x64' configuration there is a second drop down box for 'copy settings from'. That also has to be properly set to copy setting from your other configurations.

But since you have already done that, perhaps all your assembly referenences didn't copied over to your 'x64' configuration. Have you checked in your x64 project settings to see if they are there? Open up your project settings and select: Common Properties -> Framework and References Then make sure you have a reference to System (At least)