views:

25

answers:

2

Ok, so for my build configurations, I have Release32 and Release64. Each one being targeted for the specified bitness.

This is also the same for my DLLs, which are in the same solution. Now my question is: How do you update the DLL reference?

In the add reference window, you can select the DLL. I just chose the one in the Release32 directory. But I want it to reference the other DLL in the other folder when the project is built in Release64. So when it is built as a 32bit exe, it will use the 32bit dll. If it is built as a 64bit exe, it will use the 64 bit dll.

How would I accomplish the required changes?

+2  A: 

Reference the project in the Add Reference dialog. Visual Studio will pick the appropriate configuration for the dependent assembly.

Igor Zevaka
Thank you, worked great!
Eaton
+1  A: 

There is no point in building managed assemblies (DLLs) with any other platform target than Any CPU. Which will make them work properly either way.

If you do in fact have a dependency on unmanaged 32-bit or 64-bit code then you must set the the target platform for the EXE project. Only that setting has any effect, the DLLs are forced to follow suit.

This is will clearly solve your problem. In addition, the metadata in the assembly is not dependent on the platform target setting.

Hans Passant